private void updateStream ( ) throws IOException { if ( mBlockInStream != null && mBlockInStream . remaining ( ) > 0 ) { // can still read from stream return ; } if ( mBlockInStream != null && mBlockInStream . remaining ( ) == 0 ) { // current stream is done closeBlockInStream ( mBlockInStream ) ; } /* Create a new stream to read from mPosition. */ // Calculate block id. long blockId = mStatus . getBlockIds ( ) . get ( Math . toIntExact ( mPosition / mBlockSize ) ) ; // Create stream mBlockInStream = mBlockStore . getInStream ( blockId , mOptions , mFailedWorkers ) ; // Set the stream to the correct position. long offset = mPosition % mBlockSize ; mBlockInStream . seek ( offset ) ; }
Initializes the underlying block stream if necessary . This method must be called before reading from mBlockInStream .