Read an experiment from the specified URL.

@param url URL, must not be null
@return an experiment read from the specified URL
@throws IOException if an I/O error occurs
494069
public static Experiment readExperiment(final URL url) throws IOException {
        checkNotNull(url);
        try (BufferedReader reader = Resources.asCharSource(url, Charsets.UTF_8).openBufferedStream()) {
            return readExperiment(reader);
        }
    }
615686
public static byte[] readBytes(URL url) throws IOException {
        URLConnection conn = url.openConnection();
        try {
            return readBytes(conn);
        } finally {
            close(conn);
        }
    }
265060
public static XNElement parseXML(URL url) throws IOException, XMLStreamException {
        try (InputStream in = new BufferedInputStream(url.openStream())) {
            return parseXML(in);
        }
    }
982633
public static String get(String url, String params) throws IOException {
        return HttpUtil.get(url, null, params);
    }
628345
public static Experiment readExperiment(final InputStream inputStream) throws IOException {
        checkNotNull(inputStream);
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
            return readExperiment(reader);
        }
    }
1248958
public static Iterable<VcfRecord> records(final URL url) throws IOException {
        checkNotNull(url);
        try (BufferedReader reader = Resources.asCharSource(url, Charsets.UTF_8).openBufferedStream()) {
            return records(reader);
        }
    }
44205
private InputStreamReader downloadUrl(String urlString) throws IOException {
        URL url = new URL(urlString);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setReadTimeout(10000 /* milliseconds */);
        conn.setConnectTimeout(15000 /* milliseconds */);
        conn.setRequestMethod("GET");
        conn.setDoInput(true);
        // Starts the query
        conn.connect();

        return new InputStreamReader(conn.getInputStream(), "UTF-8");

    }
77100
public static void browse(String url) {
    Preconditions.checkNotNull(url);
    // Ask user to open in their browser using copy-paste
    System.out.println("Please open the following address in your browser:");
    System.out.println("  " + url);
    // Attempt to open it in the browser
    try {
      if (Desktop.isDesktopSupported()) {
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Action.BROWSE)) {
          System.out.println("Attempting to open that address in the default browser now...");
          desktop.browse(URI.create(url));
        }
      }
    } catch (IOException e) {
      LOGGER.log(Level.WARNING, "Unable to open browser", e);
    } catch (InternalError e) {
      // A bug in a JRE can cause Desktop.isDesktopSupported() to throw an
      // InternalError rather than returning false. The error reads,
      // "Can't connect to X11 window server using ':0.0' as the value of the
      // DISPLAY variable." The exact error message may vary slightly.
      LOGGER.log(Level.WARNING, "Unable to open browser", e);
    }
  }
120852
public static <T> T readUrlAsObject(String url, Class<T> type) {
		String contents = getUrlContents(url);
		ObjectMapper mapper = new ObjectMapper();
		mapper.enableDefaultTyping();

		try {
			return mapper.readValue(contents, type);
		} catch (IOException e) {
			JK.throww(e);
			return null;
		}
	}
70036
protected synchronized Document getHttpDocument(String url) 
   	throws IOException, SAXException {
   	
       Document d = null;
       d = this.builder.parse(url);
       return d;
   }
465554
public static String read(URL url, String encoding) throws IOException {
        Reader reader = getReader(url, encoding);
        String source;
        try {
            source = read(reader);
        } finally {
            reader.close();
        }
        return source;
    }
934072
static void openURL(String url) {
    try {
      openURL(new URL(url));
    } catch (MalformedURLException ex) {
      Tools.showError(ex);
    }
  }
120824
public static String get(String url,
                             Map<String, String> headers,
                             Map<String, String> params) throws IOException {

        // 参数
        if (params != null && !params.isEmpty())
            url += "?" + Utils.getUrlParamsByMap(params);

        HttpURLConnection httpUrlConn = httpUrlConn(url);
        httpUrlConn.setDoInput(true);
        httpUrlConn.setRequestMethod(Constant.RequestMethodGet);

        // header
        if (headers != null && !headers.isEmpty())
            header(headers, httpUrlConn);

        httpUrlConn.connect();

        return readIO(httpUrlConn);
    }
1129370
public static String readContentAsString(URL url, String encoding) {
        try {
            return readContentAsString(url.openStream(), encoding);
        } catch (IOException e) {
            throw E.ioException(e);
        }
    }
1335242
public static String read(URL url) throws IOException, NotFoundException {
        BufferedImage image = ImageIO.read(url);
        return read(image);
    }
473085
public static Study readStudy(final InputStream inputStream) throws IOException {
        checkNotNull(inputStream);
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
            return readStudy(reader);
        }
    }
449348
private InputStream connect(String url) throws IOException {
		URLConnection conn = new URL(URL_BASE + url).openConnection();
		conn.setConnectTimeout(CONNECT_TIMEOUT);
		conn.setReadTimeout(READ_TIMEOUT);
		conn.setRequestProperty("User-Agent", USER_AGENT);
		return conn.getInputStream();
	}