public void write ( int value ) throws IOException { if ( pos >= buf . length ) { if ( pos >= getMaxPacketLength ( ) && ! bufferContainDataAfterMark ) { //buffer is more than a Packet, must flushBuffer() flushBuffer ( false ) ; } else { growBuffer ( 1 ) ; } } buf [ pos ++ ] = ( byte ) value ; }
Write byte into buffer flush buffer to socket if needed .