Home arrow static arrow Java Programming [Archive] - how to read raw data from a input stream from a network connection
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - how to read raw data from a input stream from a network connection
This topic has 1 reply on 1 page.

Posts:6
Registered: 8/9/04
how to read raw data from a input stream from a network connection  
Aug 9, 2004 6:36 AM



 
Hello

I got a network connection which I obtained using:
HttpURLConnection connection = (HttpURLConnection)url.openConnection();connection.setDoInput(true);connection.setDoOutput (true);connection.setUseCaches (false); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");DataInputStream stream = new DataInputStream(connection.getInputStream();

How can I use the DataInputStream object to read raw data from the connection?
I would like to keep the content in the same encoding it was (UTF-8)

Am I doing it right?
Is there a better way to read raw content from a HttpURLConnection object?

jason
 

Posts:4,906
Registered: 23/07/02
Re: how to read raw data from a input stream from a network connection  
Aug 9, 2004 9:46 AM (reply 1 of 1)



 
You may need to call
connection.connect()
after setting the properties and before getting the input stream.
 
This topic has 1 reply on 1 page.