private void initChunk() throws IOException { blockPointer = blockCursor.getBlockPointer(); streamOffset = 0; if (blockCursor.getBlockType() == Constants.PLAIN_BLOCK) { inputStream = new CountingInputStream(blockCursor.getInputStream()); return; } Preconditions.checkState(blockCursor.getBlockType() == Constants.FIRST_LZMA_BLOCK); startLzmaDecoder(true); }
private void resumeLzmaDecoder() throws IOException { if (lzmaDecoder == null) { lzmaDecoder = new LzmaDecoder(blockCursor.getExecutorService()); } lzmaDecoder.init(lzmaProperties); inputStream = new CountingInputStream(lzmaDecoder.getInputStream(encodedInputStream)); }
public void next() throws IOException { streamOffset = getRecordOffset(); inputStream.close(); if (encodedInputStream != null && encodedInputStream.available() > 0) { Preconditions.checkState( blockCursor.getBlockType() == Constants.FIRST_LZMA_BLOCK || blockCursor.getBlockType() == Constants.NEXT_LZMA_BLOCK); resumeLzmaDecoder(); return; } encodedInputStream = null; blockCursor.next(); if (blockCursor.getBlockType() == Constants.NEXT_LZMA_BLOCK) { startLzmaDecoder(false); return; } initChunk(); }
public void seek(BlockPointer pointer) throws IOException { inputStream.close(); blockCursor.seek(pointer); initChunk(); }