public final Buffer limit ( int newLimit ) { if ( ( newLimit > capacity ) || ( newLimit < 0 ) ) throw new IllegalArgumentException ( ) ; limit = newLimit ; if ( position > limit ) position = limit ; if ( mark > limit ) mark = - 1 ; return this ; }
Sets this buffer s limit . If the position is larger than the new limit then it is set to the new limit . If the mark is defined and larger than the new limit then it is discarded .