public Slice slice ( int index , int length ) { if ( ( index == 0 ) && ( length == length ( ) ) ) { return this ; } checkIndexLength ( index , length ) ; if ( length == 0 ) { return Slices . EMPTY_SLICE ; } return new Slice ( base , address + index , length , reference ) ; }
Returns a slice of this buffer s sub - region . Modifying the content of the returned buffer or this buffer affects each other s content .