public void append ( byte [ ] data , int len ) { if ( data == null || len <= 0 || len > data . length ) { throw new IllegalArgumentException ( "Invalid combination of parameters data and length to append()" ) ; } int oldLimit = buffer . limit ( ) ; // grow buffer if necessary grow ( len ) ; // set positing to begin writing immediately after the last byte of the current buffer buffer . position ( oldLimit ) ; // set the buffer limit to exactly the old size plus the new appendix length buffer . limit ( oldLimit + len ) ; // append data buffer . put ( data , 0 , len ) ; }
Append a byte array to the end of the packet . This may change the data buffer of this packet .