daily pastebin goal
55%
SHARE
TWEET

webpage result java

a guest Apr 16th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.net.*;
  2. import java.io.*;
  3.  
  4. public class URLReader {
  5.     public static void main(String[] args) throws Exception {
  6.  
  7.         try {
  8.              
  9.             URL url = new URL("https://sites.google.com/site/edugamesunlimited/games/achievement-unlocked-2");
  10.             // read text returned by server
  11.             URLConnection urlConnection = url.openConnection();
  12.             InputStream is = urlConnection.getInputStream();
  13.             InputStreamReader isr = new InputStreamReader(is);
  14.             String line;
  15.             int numCharsRead;
  16.             char[] charArray = new char[1024];
  17.             StringBuffer sb = new StringBuffer();
  18.             while ((numCharsRead = isr.read(charArray)) > 0) {
  19.                 sb.append(charArray, 0, numCharsRead);
  20.             }
  21.             String result = sb.toString();
  22.            }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top