Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. URL url = new URL(myurl);
  2. URLConnection connection = null;
  3. PrintWriter out = null; BufferedReader br = null; connection = url.openConnection(); connection.setDoOutput(true);
  4. out = new PrintWriter(new OutputStreamWriter(connection.getOutputStream()),true);
  5. while(iterations)
  6. {
  7. //print data on writer
  8. out.println(object);
  9. }
  10. //closig print writer
  11. out.flush();
  12. out.close();
  13. //Response from server
  14. br = new BufferedReader(new InputStreamReader(connection.getInputStream())); // Get Exception in //this line EOF Exception
  15. String temp;
  16. while(temp = br.readLine() !=null)
  17. { //do something }
  18. br.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement