class RELPResponse {

    public RELPFrame toFrame(final Charset charset) {
        final StringBuilder builder = new StringBuilder();
        builder.append(code);

        if (message != null && !message.isEmpty()) {
            builder.append((char)RELPFrame.SEPARATOR);
            builder.append(message);
        }

        if (data != null) {
            builder.append((char)RELPFrame.DELIMITER);
            builder.append(data);
        }

        final byte[] data = builder.toString().getBytes(charset);

        return new RELPFrame.Builder()
                .txnr(txnr).command(RSP_CMD)
                .dataLength(data.length).data(data)
                .build();
    }

    public  RELPResponse(final long txnr, final int code);
    public  RELPResponse(final long txnr, final int code, final String message, final String data);

}