// non-javadoc, see interface LineFormatter
        public virtual CharArrayBuffer AppendProtocolVersion(CharArrayBuffer buffer, ProtocolVersion
                                                             version)
        {
            Args.NotNull(version, "Protocol version");
            // can't use initBuffer, that would clear the argument!
            CharArrayBuffer result = buffer;
            int             len    = EstimateProtocolVersionLen(version);

            if (result == null)
            {
                result = new CharArrayBuffer(len);
            }
            else
            {
                result.EnsureCapacity(len);
            }
            result.Append(version.GetProtocol());
            result.Append('/');
            result.Append(Sharpen.Extensions.ToString(version.GetMajor()));
            result.Append('.');
            result.Append(Sharpen.Extensions.ToString(version.GetMinor()));
            return(result);
        }
 /// <summary>Guesses the length of a formatted protocol version.</summary>
 /// <remarks>
 /// Guesses the length of a formatted protocol version.
 /// Needed to guess the length of a formatted request or status line.
 /// </remarks>
 /// <param name="version">the protocol version to format, or <code>null</code></param>
 /// <returns>
 /// the estimated length of the formatted protocol version,
 /// in characters
 /// </returns>
 protected internal virtual int EstimateProtocolVersionLen(ProtocolVersion version
                                                           )
 {
     return(version.GetProtocol().Length + 4);
 }