java program
import java.net.URL; import java.net.URLConnection; public class Main { public static void main(String[] argv) throws Exception { int size; URL url = new URL("http://www.server.com"); URLConnection conn = url.openConnection(); size = conn.getContentLength(); if (size < 0) System.out.println("Could not determine file size."); else System.out.println("The size of file is = "+size + "bytes"); conn.getInputStream().close(); } }
Output
The size of file is = 16384 bytes
- Implementation of MD5 Algorithm in Java
- Implementation of RSA Algorithm(Encryption and Decryption) in Java
- java program to get the date of URL connection
- java program to read and download a webpage
- java program to find hostname from IP Address
- java program to determine IP Address & hostname of Local Computer?
- java program to check whether a port is being used or not
- java program to find proxy settings of a System
- java program to create a socket at a specific port
- java program to get the parts of an URL