@Override public final int decodeChunk(final InputStream is, final byte[] inputBuffer, final byte[] outputBuffer) throws IOException { /* note: we do NOT read more than 5 bytes because otherwise might need to shuffle bytes * for output buffer (could perhaps optimize in future?) */ int bytesRead = readHeader(is, inputBuffer); if ((bytesRead < HEADER_BYTES) || inputBuffer[0] != LZFChunk.BYTE_Z || inputBuffer[1] != LZFChunk.BYTE_V) { if (bytesRead == 0) { // probably fine, clean EOF return -1; } _reportCorruptHeader(); } int type = inputBuffer[2]; int compLen = uint16(inputBuffer, 3); if (type == LZFChunk.BLOCK_TYPE_NON_COMPRESSED) { // uncompressed readFully(is, false, outputBuffer, 0, compLen); return compLen; } // compressed readFully(is, true, inputBuffer, 0, 2+compLen); // first 2 bytes are uncompressed length int uncompLen = uint16(inputBuffer, 0); decodeChunk(inputBuffer, 2, outputBuffer, 0, uncompLen); return uncompLen; }
@Override public final int decodeChunk(final InputStream is, final byte[] inputBuffer, final byte[] outputBuffer) throws IOException { /* note: we do NOT read more than 5 bytes because otherwise might need to shuffle bytes * for output buffer (could perhaps optimize in future?) */ int bytesRead = readHeader(is, inputBuffer); if ((bytesRead < HEADER_BYTES) || inputBuffer[0] != LZFChunk.BYTE_Z || inputBuffer[1] != LZFChunk.BYTE_V) { if (bytesRead == 0) { // probably fine, clean EOF return -1; } _reportCorruptHeader(); } int type = inputBuffer[2]; int compLen = uint16(inputBuffer, 3); if (type == LZFChunk.BLOCK_TYPE_NON_COMPRESSED) { // uncompressed readFully(is, false, outputBuffer, 0, compLen); return compLen; } // compressed readFully(is, true, inputBuffer, 0, 2+compLen); // first 2 bytes are uncompressed length int uncompLen = uint16(inputBuffer, 0); decodeChunk(inputBuffer, 2, outputBuffer, 0, uncompLen); return uncompLen; }
@Override public final int decodeChunk(final InputStream is, final byte[] inputBuffer, final byte[] outputBuffer) throws IOException { /* note: we do NOT read more than 5 bytes because otherwise might need to shuffle bytes * for output buffer (could perhaps optimize in future?) */ int bytesRead = readHeader(is, inputBuffer); if ((bytesRead < HEADER_BYTES) || inputBuffer[0] != LZFChunk.BYTE_Z || inputBuffer[1] != LZFChunk.BYTE_V) { if (bytesRead == 0) { // probably fine, clean EOF return -1; } _reportCorruptHeader(); } int type = inputBuffer[2]; int compLen = uint16(inputBuffer, 3); if (type == LZFChunk.BLOCK_TYPE_NON_COMPRESSED) { // uncompressed readFully(is, false, outputBuffer, 0, compLen); return compLen; } // compressed readFully(is, true, inputBuffer, 0, 2+compLen); // first 2 bytes are uncompressed length int uncompLen = uint16(inputBuffer, 0); decodeChunk(inputBuffer, 2, outputBuffer, 0, uncompLen); return uncompLen; }
throws IOException int bytesRead = readHeader(is, inputBuffer); if ((bytesRead < HEADER_BYTES) || inputBuffer[0] != LZFChunk.BYTE_Z || inputBuffer[1] != LZFChunk.BYTE_V) {
throws IOException int bytesRead = readHeader(is, inputBuffer); if ((bytesRead < HEADER_BYTES) || inputBuffer[0] != LZFChunk.BYTE_Z || inputBuffer[1] != LZFChunk.BYTE_V) {
throws IOException int bytesRead = readHeader(is, inputBuffer); if ((bytesRead < HEADER_BYTES) || inputBuffer[0] != LZFChunk.BYTE_Z || inputBuffer[1] != LZFChunk.BYTE_V) {