URL getContent Example

URL class getContent example. This example shows you how to use getContent method.


URL class getContent example. public final Object getContent() throws IOException Gets the contents of this URL.

Here is the code
/*
 * @ # GetContent.java
 * A class repersenting use to GetContent method 
 * of URL class in java.net package
 * version 23 June 2008
 * author Rose India 
 */

import java.net.*;

public class GetContent {

    public static void main(String args[]) throws Exception {
 
        URL url = new URL("http://localhost:8080/programs/");
        System.out.println(url.getContent().getClass().getName());
    }
}

Output
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US