URLConnection: getContentLength()
/*
* 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.java2s.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());
}
}
Related examples in the same category