Code example for StatusLine

Methods: getProtocolVersion, getReasonPhrase, getStatusCode

0
     * @param statline  the status line to format, never <code>null</code> 
     */ 
    protected void doFormatStatusLine(final CharArrayBuffer buffer,
                                      final StatusLine statline) {
 
        int len = estimateProtocolVersionLen(statline.getProtocolVersion())
            + 1 + 3 + 1; // room for "HTTP/1.1 200 " 
        final String reason = statline.getReasonPhrase();
        if (reason != null) {
            len += reason.length();
        } 
        buffer.ensureCapacity(len);
 
        appendProtocolVersion(buffer, statline.getProtocolVersion());
        buffer.append(' ');
        buffer.append(Integer.toString(statline.getStatusCode()));
        buffer.append(' '); // keep whitespace even if reason phrase is empty
        if (reason != null) {
            buffer.append(reason);
        } 
    }