private void nextSegment() throws IOException {
  ensureNotClosed();
  final SegmentBlock block=blocks.get(currentBlock);
  if (!block.hasMoreSegments())   return;
  block.nextSegment();
  long absPos=currentStartMarker + relativePos;
  currentStartMarker=block.currentStartMarker();
  currentStopMarker=block.currentStopMarker();
  if (currentStartMarker - absPos > 0) {
    long diff=in.skip(currentStartMarker - absPos);
    if (diff != currentStartMarker - absPos)     throw new IllegalStateException("Should have skipped " + (currentStartMarker - absPos) + " bytes, got "+ diff);
  }
  relativePos=0;
  segmentLen=(int)(currentStopMarker - currentStartMarker);
  if (DEBUG)   LOGGER.debug("New segment for block # " + currentBlock);
}

private void nextSegment ( ) throws IOException { ensureNotClosed ( ) ; final SegmentBlock block = blocks . get ( currentBlock ) ; if ( ! block . hasMoreSegments ( ) ) return ; block . nextSegment ( ) ; long absPos = currentStartMarker + relativePos ; currentStartMarker = block . currentStartMarker ( ) ; currentStopMarker = block . currentStopMarker ( ) ; if ( currentStartMarker - absPos > 0 ) { long diff = in . skip ( currentStartMarker - absPos ) ; if ( diff != currentStartMarker - absPos ) throw new IllegalStateException ( "Should have skipped " + ( currentStartMarker - absPos ) + " bytes, got " + diff ) ; } relativePos = 0 ; segmentLen = ( int ) ( currentStopMarker - currentStartMarker ) ; if ( DEBUG ) LOGGER . debug ( "New segment for block # " + currentBlock ) ; }
skips the underlying input stream to the next segment .
