public ChannelBuffer wrap ( ByteBuffer buffer ) { if ( buffer == null ) { throw new NullPointerException ( "buffer" ) ; } int position = buffer . position ( ) ; int limit = buffer . limit ( ) ; this . order = buffer . order ( ) ; this . buffer = buffer ; this . capacity = buffer . capacity ( ) ; setIndex ( position , limit ) ; return this ; }
Creates a new buffer which wraps the specified buffer s slice .