-
Reading web contents
Hi,
I am using the following code to fetch HTML contents of a web page. How can I use byte stream to read web contents.
Code:
public static void main(String[] str) throws Exception
{
URL url = new URL("http://www.mysite.com/abc.html");
URLConnection conn = url.openConnection();
DataInputStream in = new DataInputStream ( conn.getInputStream ( ) ) ;
BufferedReader bf = new BufferedReader(new InputStreamReader(in));
String webContents="";
while(bf.ready())
{
webContents+=bf.readLine();
}
}
Thanks in advance.
-
hi,
i don't know your answer! but i have another question: how you can filled some field and post them?
-
readByte() method of DataInputStream reads bytes. Try it out.