private void selectPage ( long offset ) { if ( currentBuffer == null || currentBuffer . seekSuccessful ( offset ) ) { currentBuffer = null ; int i = 0 ; // Look if the given offset is already stored in a page while ( i < pages . size ( ) && currentBuffer == null ) { if ( pages . get ( i ) . seekSuccessful ( offset ) ) currentBuffer = pages . get ( i ) ; i ++ ; } if ( currentBuffer == null ) { // If the offset is not contained in any of the loaded pages, create a new one // FIFO if ( pages . size ( ) >= MaxPages ) pages . remove ( 0 ) ; pages . add ( new InputBuffer ( input ) ) ; currentBuffer = pages . get ( pages . size ( ) - 1 ) ; } } }
Select buffer .