public void write(OutputStream out) throws IOException {
  int len=this.position - HEADER_LENGTH;
  if (len >= 256 * 256 * 256) {
    String message="Trying to send packet of size " + len + ", packets bigger than 16 MB are not supported yet!";
    logger.error(message);
    throw new IOException(message);
  }
  byte[] b=this.byteBuffer;
  b[0]=(byte)(len & 0xff);
  b[1]=(byte)(len >>> 8);
  b[2]=(byte)(len >>> 16);
  out.write(b,0,this.position);
}

public void write ( OutputStream out ) throws IOException { int len = this . position - HEADER_LENGTH ; if ( len >= 256 * 256 * 256 ) { String message = "Trying to send packet of size " + len + ", packets bigger than 16 MB are not supported yet!" ; logger . error ( message ) ; throw new IOException ( message ) ; } byte [ ] b = this . byteBuffer ; b [ 0 ] = ( byte ) ( len & 0xff ) ; b [ 1 ] = ( byte ) ( len > > > 8 ) ; b [ 2 ] = ( byte ) ( len > > > 16 ) ; out . write ( b , 0 , this . position ) ; }
write out the content of the buffer to the output stream .
