Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How to read text from url (with outputStream) ?

  Asked By: Nicole    Date: Apr 14    Category: Java    Views: 1046
  

big newbie with Java, i wish to read data received from a remote
server in http.

process :
1/ post data to url
2/ read data return by remote host
3/ display HTML code received

At this time, I manage to received the output stream, but when I make
a println it gives me compiled-lake characters...

Here is part of the code :

byte[] docInter = new byte[200000];
int antiLoop=0;
java.io.InputStream ip = conn.getInputStream();
while (ip.available()>0){
ip.read(docInter);
antiLoop++;
if(antiLoop> 1000){break;}
}
System.out.println("Received message from remote host : " +
docInter, true);

and this returns :
received message from remote host : [B@648e1b

instead of :
<HTML>
<HEAD>
<TITLE>
xxxxx
</TITLE>
</HEAD>
<BODY>
Your Message has been stored
<BR>
</BODY>
</HTML>

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on How to read text from url (with outputStream) ? Or get search suggestion and latest updates.




Tagged: