void writeToByteBuffer(ByteBuffer buffer,boolean mb,boolean me){
  boolean sr=mPayload.length < 256;
  boolean il=mId.length > 0;
  byte flags=(byte)((mb ? FLAG_MB : 0) | (me ? FLAG_ME : 0) | (sr ? FLAG_SR : 0)| (il ? FLAG_IL : 0)| mTnf);
  buffer.put(flags);
  buffer.put((byte)mType.length);
  if (sr) {
    buffer.put((byte)mPayload.length);
  }
 else {
    buffer.putInt(mPayload.length);
  }
  if (il) {
    buffer.put((byte)mId.length);
  }
  buffer.put(mType);
  buffer.put(mId);
  buffer.put(mPayload);
}

void writeToByteBuffer ( ByteBuffer buffer , boolean mb , boolean me ) { boolean sr = mPayload . length < 256 ; boolean il = mId . length > 0 ; byte flags = ( byte ) ( ( mb ? FLAG_MB : 0 ) | ( me ? FLAG_ME : 0 ) | ( sr ? FLAG_SR : 0 ) | ( il ? FLAG_IL : 0 ) | mTnf ) ; buffer . put ( flags ) ; buffer . put ( ( byte ) mType . length ) ; if ( sr ) { buffer . put ( ( byte ) mPayload . length ) ; } else { buffer . putInt ( mPayload . length ) ; } if ( il ) { buffer . put ( ( byte ) mId . length ) ; } buffer . put ( mType ) ; buffer . put ( mId ) ; buffer . put ( mPayload ) ; }
serialize record for network transmission . < p > uses specified mb and me flags . < p > does not chunk records .
