OpenStream_WebPage_SorceCode1
Read Source code of a web page

 

Complete Code :

/**
*
*/
import java.io.*;
import java.net.*;

/**
* @author Manas9
*
*/
public class ClassTemplate1 {
/**
*
*/
public ClassTemplate1() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args)
throws Exception {
// TODO Auto-generated method stub]
Process pr = new Process();
try {
pr.roller();

} catch (NumberFormatException exc) {
//Process
}
}
}
// end of class template
//
class Process
{
public Process()
{ System.out.println("Default constructor");}
public void roller()
{
try {
URL readURL = new URL("http://manas9/");
BufferedReader in = new BufferedReader
( new InputStreamReader(readURL.openStream()));
System.out.println("Read default home page of local IIS");
String strInput;
while ((strInput = in.readLine()) != null){
System.out.println(strInput);
}
in.close();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();}
} }
// end of Class Process
 

Runtime Out put: