src/main/java/pityoulish/sockets/server/TLVResponseBuilderImpl.java
protected int estimateLength(Message msg)
  {
    int estimate = 16; // message TLV and three nested TLV

    if (msg != null)
     {
       // originator and timestamp are ASCII
       estimate += msg.getOriginator().length();
       estimate += msg.getTimestamp().length();

       // text is Unicode
       // encoding a Unicode character in UTF-8 may require up to three byte
       estimate += msg.getText().length() * 3;
     }

    return estimate;
  }
/**
   * Estimates the data size for a single message.
   * The estimate is conservative, never too small.
   *
   * @param msg         the message to send back
   *
   * @return the estimated size of a TLV that encodes that message
   */
Estimates the data size for a single message.
The estimate is conservative, never too small.

@param msg         the message to send back

@return the estimated size of a TLV that encodes that message
Estimates the data size for a single message . The estimate is conservative never too small . @param msg the message to send back @return the estimated size of a TLV that encodes that message
protected int estimateLength(Message msg)
  {
    int estimate = 16; 
    if (msg != null)
     {
       estimate += msg.getOriginator().length();
       estimate += msg.getTimestamp().length();
       estimate += msg.getText().length() * 3;
     }
    return estimate;
  }
protected int estimateLength ( Message msg ) { int estimate = 16 ; if ( msg != null ) { estimate += msg . getOriginator ( ) . length ( ) ; estimate += msg . getTimestamp ( ) . length ( ) ; estimate += msg . getText ( ) . length ( ) * 3 ; } return estimate ; }
Estimates the data size for a single message.
Estimates the data size for a single message .
// message TLV and three nested TLV // originator and timestamp are ASCII // text is Unicode // encoding a Unicode character in UTF-8 may require up to three byte