Results 1 to 3 of 3
  1. #1
    javaplus is offline Member
    Join Date
    Nov 2007
    Posts
    97
    Rep Power
    0

    Default 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.

    Java 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.

  2. #2
    faras is offline Member
    Join Date
    Nov 2007
    Posts
    1
    Rep Power
    0

    Default

    hi,
    i don't know your answer! but i have another question: how you can filled some field and post them?

  3. #3
    javagk is offline Member
    Join Date
    Nov 2007
    Posts
    12
    Rep Power
    0

    Default

    readByte() method of DataInputStream reads bytes. Try it out.

Similar Threads

  1. Viewing contents of zip file
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-03-2008, 06:16 PM
  2. Concatenation file contents
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 02-07-2008, 02:29 PM
  3. Reading file contents (BufferedReader)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-07-2008, 10:00 AM
  4. Viewing contents of JAR file
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-21-2007, 04:12 PM
  5. Printing contents of a web page
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-26-2007, 01:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •