Intro
This examples, will demonstrates how to get content of the URL using Java program. The contents are in the HTML format.
Example
package com.freesamplecode.java.networking;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
public class GetContentURLDemo {
public static void main(String[] args){
URL url = null;
InputStream is = null;
try {
// URL site
url = new URL("http://free-samplecode.blogspot.com/p/java.html");
//open stream
is = url.openStream();
byte[] b = new byte[1024];
while(is.read(b) != -1){
System.out.println(new String(b));
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
}
}

It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.
ReplyDeleteJava Training in Chennai