BZip2 "selectorMtf value too big" error when decompressing

107 Views Asked by At

I'm getting error "Corrupted input, selectorMtf value too big" when trying to decompress the string compressed by bzip2. Below is my decompress java code

private void decompress() throws IOException {
    InputStream fin = Files.newInputStream(Paths.get("C:\\Comp.txt"));
    BufferedInputStream in = new BufferedInputStream(fin);
    OutputStream out = Files.newOutputStream(Paths.get("C:\\Dec.txt"));
    BZip2CompressorInputStream bzIn = new BZip2CompressorInputStream(in);
    final byte[] buffer = new byte[9];
    int n = 0;
    while (-1 != (n = bzIn.read(buffer))) {
        out.write(buffer, 0, n);
    }
    out.close();
    bzIn.close();
}

The error happens at this line

BZip2CompressorInputStream bzIn = new BZip2CompressorInputStream(in);

Anyone knows how to fix this error please ?

0

There are 0 best solutions below