src/main/java/pityoulish/sockets/server/TLVResponseBuilderImpl.java
protected ByteBuffer buildSimpleResponsePDU(MsgBoardType rsptype,
                                              MsgBoardType txttype,
                                              String text,
                                              boolean utf8)
  {
    if (rsptype == null)
       throw new NullPointerException("rsptype");
    if (txttype == null)
       throw new NullPointerException("txttype");
    if (text == null)
       text = "";

    byte[]      data     = new byte[estimateLength(text, utf8)];
    MsgBoardTLV response = new MsgBoardTLV(rsptype, data, 0);
    appendString(response, txttype, text, utf8);

    //System.out.println("@@@ "+response.toFullString());

    return response.toBuffer();
  }
/**
   * Builds a response with a single string as the content.
   *
   * @param rsptype     type of the response TLV
   * @param txttype     type of the nested TLV
   * @param text        the string to put into the PDU.
   *                    <code>null</code> is treated as an empty string
   * @param utf8        <code>true</code> for UTF-8 encoding,
   *                    <code>false</code> for US-ASCII
   *
   * @return a buffer containing the response PDU, backed by an array
   */
Builds a response with a single string as the content.
@param rsptype     type of the response TLV
@param txttype     type of the nested TLV
@param text        the string to put into the PDU.
null is treated as an empty string
@param utf8        true for UTF-8 encoding,
false for US-ASCII

@return a buffer containing the response PDU, backed by an array
Builds a response with a single string as the content . @param rsptype type of the response TLV @param txttype type of the nested TLV @param text the string to put into the PDU . null is treated as an empty string @param utf8 true for UTF - 8 encoding false for US - ASCII @return a buffer containing the response PDU backed by an array
protected ByteBuffer buildSimpleResponsePDU(MsgBoardType rsptype,
                                              MsgBoardType txttype,
                                              String text,
                                              boolean utf8)
  {
    if (rsptype == null)
       throw new NullPointerException("rsptype");
    if (txttype == null)
       throw new NullPointerException("txttype");
    if (text == null)
       text = "";
    byte[]      data     = new byte[estimateLength(text, utf8)];
    MsgBoardTLV response = new MsgBoardTLV(rsptype, data, 0);
    appendString(response, txttype, text, utf8);
    return response.toBuffer();
  }
protected ByteBuffer buildSimpleResponsePDU ( MsgBoardType rsptype , MsgBoardType txttype , String text , boolean utf8 ) { if ( rsptype == null ) throw new NullPointerException ( "rsptype" ) ; if ( txttype == null ) throw new NullPointerException ( "txttype" ) ; if ( text == null ) text = "" ; byte [ ] data = new byte [ estimateLength ( text , utf8 ) ] ; MsgBoardTLV response = new MsgBoardTLV ( rsptype , data , 0 ) ; appendString ( response , txttype , text , utf8 ) ; return response . toBuffer ( ) ; }
Builds a response with a single string as the content.
Builds a response with a single string as the content .
//System.out.println("@@@ "+response.toFullString());