Simlify incomplete header handling

This commit is contained in:
Taro L. Saito 2015-05-18 18:13:49 +09:00
parent 67e7cb57fd
commit ac168dfdce
1 changed files with 2 additions and 7 deletions

View File

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