private final int _handleCompressed(byte[] comp, int offset, int end) throws IOException { // One special case: if we get the whole block, can avoid buffering: int available = end-offset; if (_bytesReadFromBlock == 0 && available >= _compressedLength) { _uncompress(comp, offset, _compressedLength); offset += _compressedLength; _state = STATE_INITIAL; return offset; } // otherwise need to buffer if (_inputBuffer == null) { _inputBuffer = _recycler.allocInputBuffer(LZFChunk.MAX_CHUNK_LEN); } int amount = Math.min(available, _compressedLength - _bytesReadFromBlock); System.arraycopy(comp, offset, _inputBuffer, _bytesReadFromBlock, amount); offset += amount; _bytesReadFromBlock += amount; // Got it all? if (_bytesReadFromBlock == _compressedLength) { _uncompress(_inputBuffer, 0, _compressedLength); _state = STATE_INITIAL; } return offset; }
private final int _handleCompressed(byte[] comp, int offset, int end) throws IOException { // One special case: if we get the whole block, can avoid buffering: int available = end-offset; if (_bytesReadFromBlock == 0 && available >= _compressedLength) { _uncompress(comp, offset, _compressedLength); offset += _compressedLength; _state = STATE_INITIAL; return offset; } // otherwise need to buffer if (_inputBuffer == null) { _inputBuffer = _recycler.allocInputBuffer(LZFChunk.MAX_CHUNK_LEN); } int amount = Math.min(available, _compressedLength - _bytesReadFromBlock); System.arraycopy(comp, offset, _inputBuffer, _bytesReadFromBlock, amount); offset += amount; _bytesReadFromBlock += amount; // Got it all? if (_bytesReadFromBlock == _compressedLength) { _uncompress(_inputBuffer, 0, _compressedLength); _state = STATE_INITIAL; } return offset; }
private final int _handleCompressed(byte[] comp, int offset, int end) throws IOException { // One special case: if we get the whole block, can avoid buffering: int available = end-offset; if (_bytesReadFromBlock == 0 && available >= _compressedLength) { _uncompress(comp, offset, _compressedLength); offset += _compressedLength; _state = STATE_INITIAL; return offset; } // otherwise need to buffer if (_inputBuffer == null) { _inputBuffer = _recycler.allocInputBuffer(LZFChunk.MAX_CHUNK_LEN); } int amount = Math.min(available, _compressedLength - _bytesReadFromBlock); System.arraycopy(comp, offset, _inputBuffer, _bytesReadFromBlock, amount); offset += amount; _bytesReadFromBlock += amount; // Got it all? if (_bytesReadFromBlock == _compressedLength) { _uncompress(_inputBuffer, 0, _compressedLength); _state = STATE_INITIAL; } return offset; }