At work I'm implementing a new webservice that works with files. The specifications say that we should not accept .zip files if they are compressed.
Is there such a thing as a not compressed .zip file? If yes, what do you think would be the best way to detect one using Java (1.8)?
Yes, a zip can be uncompressed. In fact, early
.jar
files were just uncompressed.zip
files.The
ZipEntry
class hasgetMethod
to get the compression method of an entry. One of the options isSTORED
(e.g., not compressed).