public Slice copySlice ( int index , int length ) { checkPositionIndexes ( index , index + length , this . length ) ; index += offset ; byte [ ] copiedArray = new byte [ length ] ; System . arraycopy ( data , index , copiedArray , 0 , length ) ; return new Slice ( copiedArray ) ; }
Returns a copy of this buffer s sub - region . Modifying the content of the returned buffer or this buffer does not affect each other at all .