3

I'm trying to decompress a .zst file the following way :

public byte[] decompress() {
byte[] compressedBytes = Files.readAllBytes(Paths.get(PATH_TO_ZST));
final long size = Zstd.decompressedSize(compressedBytes);
return Zstd.decompress(compressedBytes, (int)size);
}

and I'm running into this :

com.github.luben.zstd.ZstdException: Unknown frame descriptor [java] com.github.luben.zstd.ZstdDecompressCtx.decompressByteArray(ZstdDecompressCtx.java:157) [java] com.github.luben.zstd.ZstdDecompressCtx.decompress(ZstdDecompressCtx.java:214) [java]

Has anyone faced something similar? Thanks!

user2589299
  • 109
  • 1
  • 10

2 Answers2

0

That error means zstd doesn't recognize the first 4 bytes of the frame. This can be because either:

  1. The data is not in zstd format,
  2. There is excess data at the end of the zstd frame.

You'll also want to check the output of Zstd.decompressedSize() for 0, which means the frame is corrupted, or the size wasn't present in the frame header. See the documentation.

Nick
  • 387
  • 1
  • 9
  • 2
    This does not help. i am also facing this error. i did compression using zstd and then i also checked decompressionSize which returns original size from the header which gave the right number. then i tried to decompress and that is when i get the error stating unknown frame descriptor. – Jay Ghiya Jan 31 '22 at 10:41
0
public byte[] decompress() {
     byte[] compressedBytes = Files.readAllBytes(Paths.get(PATH_TO_ZST));
     final long size = Zstd.decompressedSize(compressedBytes);
     byte[] deCompressedBytes = new byte[size];
     Zstd.decompress(deCompressedBytes,compressedBytes);
     return deCompressedBytes;
}
James Wang
  • 31
  • 8