When I download a file in java I’d like to save the getDate value
URL url = new URL("http://theurl.com");
URLConnection conn = url.openConnection();
conn.getDate()
This way, the next time the file is needed I check the lastModified() VS getDate() and if the file changed re-download it.
My question is if is there some place or technique I can use for save the getDate() of the download moment without using a database (maybe using some special place in the file for aditional info or similar)
Note: I can’t use the name of the file because it must be the original one
Well it really sounds like you could benefit from a meta data storage along with the file storage though…
But a hack could be to set the modified time on the file using the
java.io.FilemethodsetLastModified, though that could be changed by others as well (for example by opening the file in an editor for the file) which would be bad for you.