Open
Description
Hi,
I am trying to port ZstdDecompressor to C# and I have hard time understanding how ZstdDecompressor.getDecompressedSize should work.
If I modify testDecompressWithOutputPaddingAndChecksum()
to following
public void testDecompressWithOutputPaddingAndChecksum()
throws IOException
{
int padding = 1021;
byte[] compressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/with-checksum.zst"));
byte[] uncompressed = Resources.toByteArray(getClass().getClassLoader().getResource("data/zstd/with-checksum"));
byte[] output = new byte[uncompressed.length + padding * 2]; // pre + post padding
int decompressedSize = getDecompressor().decompress(compressed, 0, compressed.length, output, padding, output.length);
long decompressedSize2 = ZstdDecompressor.getDecompressedSize(compressed, 0, compressed.length);
assertEquals(decompressedSize2, 11359, "Should be equal");
assertByteArraysEqual(uncompressed, 0, uncompressed.length, output, padding, decompressedSize);
}
then the decompressedSize2
has value -1 and test fails. Am I missing something in here?
Metadata
Metadata
Assignees
Labels
No labels