mirror of
https://github.com/xerial/snappy-java.git
synced 2025-07-03 12:14:27 +02:00
change snappyOutputStream writeHeader order to fix when outputStream… (#229)
* change snappyOutputStream writeHeader order to fix when outputStream doest't write bytes, it will also generate a snappy header after closed
This commit is contained in:
parent
de99182a82
commit
79697cf3d4
@ -365,22 +365,18 @@ public class SnappyOutputStream
|
||||
protected void compressInput()
|
||||
throws IOException
|
||||
{
|
||||
if (inputCursor <= 0) {
|
||||
return; // no need to dump
|
||||
}
|
||||
|
||||
if (!headerWritten) {
|
||||
outputCursor = writeHeader();
|
||||
headerWritten = true;
|
||||
}
|
||||
|
||||
if (inputCursor <= 0) {
|
||||
return; // no need to dump
|
||||
}
|
||||
// Compress and dump the buffer content
|
||||
if (!hasSufficientOutputBufferFor(inputCursor)) {
|
||||
dumpOutput();
|
||||
}
|
||||
|
||||
writeBlockPreemble();
|
||||
|
||||
int compressedSize = Snappy.compress(inputBuffer, 0, inputCursor, outputBuffer, outputCursor + 4);
|
||||
// Write compressed data size
|
||||
writeInt(outputBuffer, outputCursor, compressedSize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user