Simlify incomplete header handling
This commit is contained in:
parent
67e7cb57fd
commit
ac168dfdce
|
@ -95,11 +95,6 @@ public class SnappyInputStream
|
||||||
}
|
}
|
||||||
if (readBytes < header.length || header[0] != SnappyCodec.MAGIC_HEADER[0]) {
|
if (readBytes < header.length || header[0] != SnappyCodec.MAGIC_HEADER[0]) {
|
||||||
// do the default uncompression
|
// do the default uncompression
|
||||||
readFully(header, readBytes);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isValidHeader(header)) {
|
|
||||||
// (probably) compressed by Snappy.compress(byte[])
|
// (probably) compressed by Snappy.compress(byte[])
|
||||||
readFully(header, readBytes);
|
readFully(header, readBytes);
|
||||||
return;
|
return;
|
||||||
|
@ -393,8 +388,8 @@ public class SnappyInputStream
|
||||||
// Concatenated data
|
// Concatenated data
|
||||||
int remainingHeaderSize = SnappyCodec.headerSize() - 4;
|
int remainingHeaderSize = SnappyCodec.headerSize() - 4;
|
||||||
readBytes = readNext(header, 4, remainingHeaderSize);
|
readBytes = readNext(header, 4, remainingHeaderSize);
|
||||||
if (readBytes < remainingHeaderSize) {
|
if(readBytes < remainingHeaderSize) {
|
||||||
return false;
|
throw new SnappyIOException(SnappyErrorCode.FAILED_TO_UNCOMPRESS, String.format("Insufficient header size in a concatenated block"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isValidHeader(header)) {
|
if (isValidHeader(header)) {
|
||||||
|
|
Loading…
Reference in New Issue