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…
Reference in New Issue