reading input from UrlConnections
I am having a problem reading input from a URLConnection object.
I am using a servlet to read from a site and print the data out on my site.
My code goes like:
String urlString = "http://www.moreover.com";
URL redirectURL = new URL(urlString);
URLConnection conn = redirectURL.openConnection();
DataInputStream dIn = new DataInputStream(conn.getInputStream());
String r = dIn.readUTF();
//now print it out to the screen...
However the HTML is corrupted and only a portion of what should be displayed,
is displayed. I think there is some conversion issue, although I am unable
to obtain the content encoding from the URLConnection and the ContentType
Any help would be greatly appreciated as this is driving me mad!
Thanks in advance,
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center