List of utility methods to do URL Download
List | get(String url, int timeout, Map header) Method to make a GET request to the specified url return request(url, timeout, "GET", header); |
String | get(String url, Map Send a get request return fetch("GET", url, null, headers); |
String | get(String url, Map get StringBuilder sb = new StringBuilder(); if (!params.isEmpty()) { sb.append("?"); int idx = 0; for (String column : params.keySet()) { if (idx > 0) { sb.append("&"); ... |
String | get(String url, String encoding) get return getStreamContent(new URL(url).openConnection().getInputStream()); |
String | get(String urlStr) get try { URL url = new URL(urlStr); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setInstanceFollowRedirects(true); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); List<String> lines = in.lines().collect(Collectors.toList()); in.close(); ... |
byte[] | get(String urlString) get HttpURLConnection urlConnection = null; try { URL url = new URL(urlString); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.setConnectTimeout(5000); urlConnection.setReadTimeout(3000); int responseCode = urlConnection.getResponseCode(); ... |
int | get(URL host, String endpoint, String customer, String name, String version, OutputStream out) get int responseCode; URL url = new URL(host, endpoint + "?customer=" + customer + "&name=" + name + "&version=" + version); InputStream input = null; HttpURLConnection connection = (HttpURLConnection) url.openConnection(); try { responseCode = connection.getResponseCode(); input = connection.getInputStream(); copy(input, out); ... |
String | get(URL url) get HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); BufferedReader input = new BufferedReader(new InputStreamReader(connection.getInputStream())); StringBuilder buffer = new StringBuilder(); for (String line; (line = input.readLine()) != null;) { buffer.append(line); buffer.append("\n"); input.close(); return buffer.toString(); |
InputStream | get(URL url, String acceptType) Sends HTTP GET request HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setDoOutput(true); con.setRequestMethod("GET"); con.setRequestProperty("accept", acceptType); return con.getInputStream(); |