Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. readStream(in)
  2.  
  3. URL url = new URL("http://www.android.com/");
  4. HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
  5. try
  6. {
  7. InputStream in = new BufferedInputStream(urlConnection.getInputStream());
  8. readStream(in); <-----NO SUCH METHOD
  9. }
  10. finally
  11. {
  12. urlConnection.disconnect();
  13. }
  14.  
  15. InputStream in = address.openStream();
  16. BufferedReader reader = new BufferedReader(new InputStreamReader(in));
  17. StringBuilder result = new StringBuilder();
  18. String line;
  19. while((line = reader.readLine()) != null) {
  20. result.append(line);
  21. }
  22. System.out.println(result.toString());
  23.  
  24. import org.springframework.util.FileCopyUtils;
  25.  
  26. InputStream is = connection.getInputStream();
  27. ByteArrayOutputStream bos = new ByteArrayOutputStream();
  28. FileCopyUtils.copy(is, bos);
  29. String data = new String(bos.toByteArray());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement