Mega Code Archive

 
Categories / Java by API / Javax Net
 

New URL(String protocol, String host, int port, String file)

/*  * Output:  *  Date: 1145919603000 Type: text/html Exp: 0 Last M: 1143834458000 Length: 208546  */ import java.net.URL; import java.net.URLConnection; public class MainClass {   public static void main(String args[]) throws Exception {     int c;     URL hp = new URL("http", "www.rntsoft.com", 80, "/");     URLConnection hpCon = hp.openConnection();     System.out.println("Date: " + hpCon.getDate());     System.out.println("Type: " + hpCon.getContentType());     System.out.println("Exp: " + hpCon.getExpiration());     System.out.println("Last M: " + hpCon.getLastModified());     System.out.println("Length: " + hpCon.getContentLength());   } }