DBI 2008 HUJI-CS 32 public class ContentExtractor { public static void main(String[] argv) throws Exception { URL url = new URL(argv[0]); System.out.println( Host: + url.getHost()); System.out.println( Protocol: + url.getProtocol()); System.out.println( ---- ); URLConnection con = url.openConnection(); InputStream stream = con.getInputStream(); byte[] data = new byte[4096]; int bytesRead = 0; while((bytesRead=stream.read(data))>=0) { System.out.write(data,0,bytesRead); }}}
{}