Created
March 25, 2010 19:13
-
-
Save raymyers/343982 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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