URL Connection Reader : URL : Network Protocol : Java examples (example source code) Organized by topic

Java
C++
PHP
Java Home »  Network Protocol   » [  URL  ]  Screenshots 
 



URL Connection Reader



/* From http://java.sun.com/docs/books/tutorial/index.html */

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

public class URLConnectionReader {
  public static void main(String[] argsthrows Exception {
    URL yahoo = new URL("http://www.yahoo.com/");
    URLConnection yahooConnection = yahoo.openConnection();
    BufferedReader in = new BufferedReader(new InputStreamReader(
        yahooConnection.getInputStream()));
    String inputLine;

    while ((inputLine = in.readLine()) != null)
      System.out.println(inputLine);

    in.close();
  }
}

           
       
Related examples in the same category
1.  URL Constructor Test
2.  URL Encode Test
3.  Get URL Content
4.  Get URL Parts
5.  Read from a URL
6.  URL Equality
7.  URL Request
8.  URL Get
9.  URL Reader
10.  URLConnection
11.  Parse URL Parse URL








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.