Skip to content

Instantly share code, notes, and snippets.

@raymyers
Created March 25, 2010 19:13
Show Gist options
  • Save raymyers/343982 to your computer and use it in GitHub Desktop.
Save raymyers/343982 to your computer and use it in GitHub Desktop.
package com.cadrlife.util;
/*
* A simple Java class to provide functionality similar to Wget.
*/
import java.io.*;
import java.net.*;
import org.apache.commons.io.IOUtils;
public class JGet {
public String get(String url) {
InputStream is = null;
try {
return IOUtils.toString(is = new URL(url).openStream());
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
IOUtils.closeQuietly(is);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment