Skip to content

Instantly share code, notes, and snippets.

@dylanmei
Created March 25, 2013 14:54
Show Gist options
  • Save dylanmei/5237667 to your computer and use it in GitHub Desktop.
Save dylanmei/5237667 to your computer and use it in GitHub Desktop.
Reading a page with java/beanshell
import java.io;
url = new URL("http://www.yahoo.com");
stream = new InputStreamReader(url.openStream());
reader = new BufferedReader(stream);
buffer = new StringBuilder();
while ((line = reader.readLine()) != null) {
buffer.append(line + '\n');
}
reader.close();
stream.close();
System.out.println(buffer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment