/* * url.java * * Created on April 22, 2002, 12:50 PM */ import java.net.*; import java.io.*; /** * * @author subodh * @version */ class readURL { private URL url; /** Creates new readURL */ public readURL () throws MalformedURLException, IOException, UnknownHostException { url = new URL("http://www.cs.jhu.edu"); System.out.println("URL is " + url); InetAddress ipaddr = InetAddress.getByName(url.getHost()); System.out.println("HOST address is " + ipaddr.getHostAddress()); // byte B[] = ipaddr.getAddress(); InputStream ins = url.openStream(); BufferedReader fp = new BufferedReader(new InputStreamReader(ins)); String s; s = fp.readLine(); System.out.println("Line 1: " + s); s = fp.readLine(); System.out.println("Line 2: " + s); s = fp.readLine(); System.out.println("Line 3: " + s); } } class testURL { /** Creates new test */ public testURL() { } /** * @param args the command line arguments */ public static void main (String args[]) throws MalformedURLException,IOException, UnknownHostException { readURL readurl = new readURL(); // System.out.println("Hello World"); } }