synchronized void addChunks ( List < SegmentChunk > segmentChunks ) { Preconditions . checkState ( ! this . sealed , "Cannot add SegmentChunks for a Sealed Handle." ) ; long expectedOffset = 0 ; if ( this . segmentChunks . size ( ) > 0 ) { expectedOffset = this . segmentChunks . get ( this . segmentChunks . size ( ) - 1 ) . getLastOffset ( ) ; } else if ( segmentChunks . size ( ) > 0 ) { expectedOffset = segmentChunks . get ( 0 ) . getStartOffset ( ) ; } for ( SegmentChunk s : segmentChunks ) { Preconditions . checkArgument ( s . getStartOffset ( ) == expectedOffset , "Invalid SegmentChunk StartOffset. Expected %s, given %s." , expectedOffset , s . getStartOffset ( ) ) ; expectedOffset += s . getLength ( ) ; } this . segmentChunks . addAll ( segmentChunks ) ; this . activeChunkHandle = null ; }
Adds multiple SegmentChunks .