List of utility methods to do URL Load
String | readTextFromUrl(URL url) Return the text of the file with the given URL. StringBuffer fubber = new StringBuffer(); try { BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) { fubber.append(inputLine).append("\n"); in.close(); ... |
String | readTextStream(URL url, String encoding) read a text from a URL InputStream in = url.openStream();
return readTextStream(in, encoding);
|
String | readTextURL(URL url) read Text URL try { return readText(url.openStream()); } catch (Exception e) { throw new RuntimeException("Reading from URL \"" + url + "\" failed", e); |
String | readURL(final URL fileURL) read URL return readAll(new InputStreamReader(fileURL.openStream())); |
byte[] | readURL(final URL url) Reads the data at the supplied URL and returns it as a byte array. return readInputStream(url.openStream());
|
String | readUrl(final URL url) Reads an url to string; should only be used for non-blocking connections (f.e. final InputStream stream = url.openStream(); final BufferedReader in = new BufferedReader(new InputStreamReader(stream)); String inputLine; final StringBuffer result = new StringBuffer(); while ((inputLine = in.readLine()) != null) { if (result.length() > 0) { result.append("\n"); result.append(inputLine); in.close(); return result.toString(); |
StringBuilder | readUrl(final URL url) read Url final BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream())); try { final StringBuilder content = new StringBuilder(); String line = null; while ((line = r.readLine()) != null) { content.append(line).append("\n"); return content; ... |
String | readURL(String URL) read URL URL url = new URL(URL); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); return ReaderToString(in); |
String | readURL(String url) read URL final BufferedReader reader = new BufferedReader(newInputStreamReader(url)); try { return reader.readLine(); } finally { reader.close(); |
String | readURL(String url) Read data from a properly formatted URL and return it as a string. InputStream is = new URL(url).openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuffer buffer = new StringBuffer(); String line = null; while ((line = reader.readLine()) != null) { buffer.append(line); buffer.append(EOL); is.close(); return buffer.toString(); |