src/main/java/pityoulish/sockets/server/TLVResponseBuilderImpl.java
protected int estimateLength(String s, boolean utf8)
  {
    int estimate = 8; // response TLV and nested TLV header

    if (s != null)
     {
       // encoding a Unicode character in UTF-8 may require up to three byte
       final int factor = utf8 ? 3 : 1;
       estimate += s.length() * factor;
     }

    return estimate;
  }
/**
   * Estimates the data size for a response with a single string.
   * The estimate is conservative, never too small.
   *
   * @param s           the string to send back, or <code>null</code>
   * @param utf8        <code>true</code> for UTF-8 encoding,
   *                    <code>false</code> for US-ASCII
   *
   * @return the estimated size of an array that can hold the response PDU
   */
Estimates the data size for a response with a single string.
The estimate is conservative, never too small.

@param s           the string to send back, or null
@param utf8        true for UTF-8 encoding,
false for US-ASCII

@return the estimated size of an array that can hold the response PDU
Estimates the data size for a response with a single string . The estimate is conservative never too small . @param s the string to send back or null @param utf8 true for UTF - 8 encoding false for US - ASCII @return the estimated size of an array that can hold the response PDU
protected int estimateLength(String s, boolean utf8)
  {
    int estimate = 8; 
    if (s != null)
     {
       final int factor = utf8 ? 3 : 1;
       estimate += s.length() * factor;
     }
    return estimate;
  }
protected int estimateLength ( String s , boolean utf8 ) { int estimate = 8 ; if ( s != null ) { final int factor = utf8 ? 3 : 1 ; estimate += s . length ( ) * factor ; } return estimate ; }
Estimates the data size for a response with a single string.
Estimates the data size for a response with a single string .
// response TLV and nested TLV header // encoding a Unicode character in UTF-8 may require up to three byte