Java Utililty Methods URL Load

List of utility methods to do URL Load

Description

The list of methods to do URL Load are organized into topic(s).

Method

StringreadTextFromUrl(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();
...
StringreadTextStream(URL url, String encoding)
read a text from a URL
InputStream in = url.openStream();
return readTextStream(in, encoding);
StringreadTextURL(URL url)
read Text URL
try {
    return readText(url.openStream());
} catch (Exception e) {
    throw new RuntimeException("Reading from URL \"" + url + "\" failed", e);
StringreadURL(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());
StringreadUrl(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();
StringBuilderreadUrl(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;
...
StringreadURL(String URL)
read URL
URL url = new URL(URL);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
return ReaderToString(in);
StringreadURL(String url)
read URL
final BufferedReader reader = new BufferedReader(newInputStreamReader(url));
try {
    return reader.readLine();
} finally {
    reader.close();
StringreadURL(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();