I was presented with the situation where a file with a proprietary format was compressed to a .gz, then subsequently renamed it back to its original extension and then compressed again. I would like to capture such scenario and wonder whether there is a way to detect when a file has been compressed twice.
I am reading the .gz files as follows:
GZIPInputStream gzip = new GZIPInputStream(Files.newInputStream(inFile));
BufferedReader breader = new BufferedReader(new InputStreamReader(gzip));