public synchronized void setLength ( int length ) { if ( ( length + offset ) > buf . length || length < 0 || ( length + offset ) < 0 ) { throw new IllegalArgumentException ( "illegal length" ) ; } this . length = length ; this . bufLength = this . length ; }
Set the length for this packet . The length of the packet is the number of bytes from the packet s data buffer that will be sent or the number of bytes of the packet s data buffer that will be used for receiving data . The length must be lesser or equal to the offset plus the length of the packet s buffer .