Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Read from BufferedInputStream

 
Kenneth Toshney
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've got a JSP page which has to read the html code returned by a URL as it contains a certain number of parameters which I must use for further processing. I have the following code so far:
URL url = new URL("myurl");
URLConnection conn = url.openConnection();
InputStream in = new BufferedInputStream(conn.getInputStream());
Probably something really simple this but how do I get the text HTML document's code from the BufferedInputStream into a string variable? By the way 'myurl' is replaced by the actual url I am using in my JSP.
Any help would be appreciated.
Thanks
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kenneth,
I believe your code should be more like this:
[NOTE: Uncompiled and untested!]

Hope it helps.
Good Luck,
Avi.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65537
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is really an I/O question, so I'm going to shuffle it along to that forum.
bear
 
Bring out your dead! Or a tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!