Reputation: 129
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!
Upvotes: 5
Views: 13235
Reputation: 43
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;
}
Upvotes: 0
Reputation: 407
That error means zstd doesn't recognize the first 4 bytes of the frame. This can be because either:
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.
Upvotes: 0