import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; public class FetchHTML { protected String HTML; protected String theURL; public FetchHTML(String theURL) throws IOException { this.theURL=theURL; this.theURL=""; } protected void fetch() throws IOException { URL url = new URL(theURL); InputStream is = url.openStream(); int ptr = 0; StringBuffer buffer = new StringBuffer(); while ((ptr = is.read()) != -1) { buffer.append((char)ptr); } HTML=buffer.toString(); } @Override public String toString() { return HTML; } }