Java URLConnection .getInputStream ()
Syntax
URLConnection.getInputStream() has the following syntax.
public InputStream getInputStream() throws IOException
Example
In the following code shows how to use URLConnection.getInputStream() method.
/* w ww.jav a 2 s.co m*/
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class Main{
public static void main(String args[]) throws Exception {
URL url = new URL("http://www.google.com");
URLConnection httpCon = (URLConnection) url.openConnection();
InputStream s = httpCon.getInputStream();
}
}