private void ensureCapacity ( int segmentIndex ) { while ( segmentIndex >= segments . length ) { segments = Arrays . copyOf ( segments , segments . length * 3 / 2 ) ; } if ( segments [ segmentIndex ] == null ) { segments [ segmentIndex ] = memoryRecycler . getByteArray ( ) ; } }
Ensures that the segment at segmentIndex exists