Zstd解压错误 - 未知的帧描述符

3
我正在尝试按以下方式解压缩.zst文件:
public byte[] decompress() {
byte[] compressedBytes = Files.readAllBytes(Paths.get(PATH_TO_ZST));
final long size = Zstd.decompressedSize(compressedBytes);
return Zstd.decompress(compressedBytes, (int)size);
}

我遇到了这个问题:

com.github.luben.zstd.ZstdException: 未知的帧描述符 [java] com.github.luben.zstd.ZstdDecompressCtx.decompressByteArray(ZstdDecompressCtx.java:157) [java] com.github.luben.zstd.ZstdDecompressCtx.decompress(ZstdDecompressCtx.java:214) [java]

有人遇到过类似的情况吗?谢谢!

2个回答

0

这个错误意味着zstd无法识别帧的前4个字节。 这可能是因为:

  1. 数据不是以zstd格式呈现的,
  2. 在zstd帧末尾存在多余的数据。

您还需要检查Zstd.decompressedSize()的输出是否为0,这意味着帧已损坏或大小未出现在帧头中。请参阅文档


2
这并没有帮助。我也遇到了这个错误。我使用zstd进行了压缩,然后我还检查了decompressionSize,它从头部返回原始大小,给出了正确的数字。然后我尝试解压缩,但是当我得到未知的帧描述符错误时。 - Jay Ghiya

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;
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接