Duveaux

Untitled

Apr 22nd, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1.               protected String doInBackground(String... params) {
  2.                   String result = "";
  3.                   Integer MAXVALUE = 10000;
  4.                   try {
  5.                     // Create a URL for the desired page
  6.                     URL url = new URL("URL");
  7.                    
  8.                     // Read all the text returned by the server
  9.                     BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
  10.                   char[] resultTab=new char[MAXVALUE];
  11.                  int i=0;
  12.                  while ((resultTab[i] = (char) in.read()) != -1) {
  13.                           i++;
  14.                  }
  15.                  result = String.copyValueOf(resultTab, 0, i);
  16.                     in.close();
  17.                 } catch (MalformedURLException e) {
  18.                 } catch (IOException e) {
  19.                 }
  20.                   return result;
  21.               }
Advertisement
Add Comment
Please, Sign In to add comment