Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.*;
- import java.io.*;
- public class URLReader {
- public static void main(String[] args) throws Exception {
- try {
- URL url = new URL("https://sites.google.com/site/edugamesunlimited/games/achievement-unlocked-2");
- // read text returned by server
- URLConnection urlConnection = url.openConnection();
- InputStream is = urlConnection.getInputStream();
- InputStreamReader isr = new InputStreamReader(is);
- String line;
- int numCharsRead;
- char[] charArray = new char[1024];
- StringBuffer sb = new StringBuffer();
- while ((numCharsRead = isr.read(charArray)) > 0) {
- sb.append(charArray, 0, numCharsRead);
- }
- String result = sb.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement