/// <summary>
 /// Writes characters from the specified char array followed by a line
 /// delimiter to this session buffer.
 /// </summary>
 /// <remarks>
 /// Writes characters from the specified char array followed by a line
 /// delimiter to this session buffer.
 /// <p>
 /// This method uses CR-LF as a line delimiter.
 /// </remarks>
 /// <param name="charbuffer">the buffer containing chars of the line.</param>
 /// <exception>
 /// IOException
 /// if an I/O error occurs.
 /// </exception>
 /// <exception cref="System.IO.IOException"></exception>
 public virtual void WriteLine(CharArrayBuffer charbuffer)
 {
     if (charbuffer == null)
     {
         return;
     }
     if (this.encoder == null)
     {
         int off       = 0;
         int remaining = charbuffer.Length();
         while (remaining > 0)
         {
             int chunk = this.buffer.Capacity() - this.buffer.Length();
             chunk = Math.Min(chunk, remaining);
             if (chunk > 0)
             {
                 this.buffer.Append(charbuffer, off, chunk);
             }
             if (this.buffer.IsFull())
             {
                 FlushBuffer();
             }
             off       += chunk;
             remaining -= chunk;
         }
     }
     else
     {
         CharBuffer cbuf = CharBuffer.Wrap(charbuffer.Buffer(), 0, charbuffer.Length());
         WriteEncoded(cbuf);
     }
     Write(Crlf);
 }