Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. private void print_content(HttpsURLConnection con) throws IOException {
  2. if (con != null) {
  3. System.out.println("****** Content of the URL ********");
  4. BufferedReader br = null;
  5. InputStreamReader inputStreamReader = null;
  6. try {
  7. inputStreamReader = new InputStreamReader(con.getInputStream());
  8. br = new BufferedReader(inputStreamReader);
  9. String input;
  10. while ((input = br.readLine()) != null) {
  11. System.out.println(input);
  12. }
  13. } finally {
  14. con.disconnect();
  15. if (null != inputStreamReader) {
  16. inputStreamReader.close();
  17. }
  18. if (null != br) {
  19. br.close();
  20. }
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement