From an applet, how do I get information, like size and creation time, about a file on the server?
Created May 4, 2012
Brian O'Byrne Assuming you have access to the file in question through a web server, you can use the URLConnection methods getContentLength() and getLastModified().
URL fileOfInterest = new URL(...); URLConnection connectionToFileOfInterest = fileOfInterest.getConnection(); int contentLength = connectionToFileOfInterest.getContentLength(); long lastModifiedTime = connectionToFileOfInterest.getLastModified();You cannot get the creation time this way.
Warning: this is not reliable across Web servers and you may end up downloading the file completely to get the size.