javafile-iocontent-lengthhttp-content-length

How to get a file size in Bytes or in MB's through a URL


I am new to Java.. I was trying to get the file size from a URL but I failed can any one help me how to get the URL size in bytes?


Solution

  • Use the getContentLength method of the URLConnection which is obtained from URL#openConnection