protected void encode ( ByteBuffer txBuffer ) { txBuffer . position ( 4 ) ; // Length int txBuffer . put ( data ) ; int length = txBuffer . position ( ) ; txBuffer . rewind ( ) ; txBuffer . putInt ( length ) ; txBuffer . position ( length ) ; }
Encodes this message . The protocol is first 4 bytes are length of this command followed by the byte stream of command