I'm tha maintainer of https://github.com/compress4j/compress4j and writing a new framework to add some more features.
I have hit a problem in Gzip test cases in TarGzCompressorTest are failing with java.io.IOException: Input is not in the .gz format
, I've manually verified the gz files produces by the test case, they are valid and I can extract them by tar -xzvf test.tar.gz
.
Any ideas/pointers?
I've the problem, I don't know what I was thinking but I had to much code
InputStream input = new BufferedInputStream(sourceStream);
try {
input = new CompressorStreamFactory().createCompressorInputStream(input);
} catch (CompressorException e) {
Throwable cause = e.getCause();
if (cause instanceof IOException ioException) throw ioException;
}
archiveInputStream = this.buildArchiveInputStream(input);
I was creating a CompressorInputStream
and passing that into the ArchiveInputStream
and causing the problem.
Fix was to just to pass the source stream directly, as follows
archiveInputStream = this.buildArchiveInputStream(sourceStream);