www.pudn.com > lxc.rar > ASimpleBrowser.java


import java.io.*; 
import java.net.*; 
 
 
public class ASimpleBrowser{ 
     public ASimpleBrowser(){ 
     } 
     public static void main(String args[]){ 
         byte urlBytes[]=new byte[20]; 
         System.out.println("input the web site's name"); 
          
         try{   
               System.in.read(urlBytes); 
               URL aURL=new URL(new String(urlBytes)); 
               InputStream in=aURL.openStream(); 
               int c; 
               while((c=in.read())!=-1){ 
         	   System.out.write(c); 
               } 
         } 
         catch(MalformedURLException e1){ 
         	     e1.printStackTrace(); 
         	} 
         catch(IOException e2){ 
         	     e2.printStackTrace(); 
         	}            
     }      
}