示例#1
0
 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);
 }
示例#2
0
 private void resumeLzmaDecoder() throws IOException {
   if (lzmaDecoder == null) {
     lzmaDecoder = new LzmaDecoder(blockCursor.getExecutorService());
   }
   lzmaDecoder.init(lzmaProperties);
   inputStream = new CountingInputStream(lzmaDecoder.getInputStream(encodedInputStream));
 }
示例#3
0
 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();
 }
示例#4
0
 public void seek(BlockPointer pointer) throws IOException {
   inputStream.close();
   blockCursor.seek(pointer);
   initChunk();
 }