docs: private boolean buildHeader(HeaderFields headerFields, WsByteBuffer xmitBuffer)
     {
        if (tc.isEntryEnabled()) SibTr.entry(this, tc, "buildHeader", new Object[] {headerFields, xmitBuffer});
        if (tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, xmitBuffer, "xmitBuffer");
        
        boolean headerFinished = false;
        WsByteBuffer headerBuffer = null;
        
        if (headerScratchSpace.position() == 0)
        {
           if (tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBufferInfo(this, tc, headerScratchSpace, "headerScratchSpace");
           
           // No data in the scratch space buffer - so we must decide if we can
           // build this header in place.
           if (xmitBuffer.remaining() >= headerFields.sizeof())
           {
              // Enough space in the transmission buffer to build the header in
              // place.
              headerBuffer = xmitBuffer;
              headerFields.writeToBuffer(xmitBuffer);
              headerFinished = true;
           }
           else
           {
              // Insufficient room in the transmission buffer to build the header
              // in place.
              headerBuffer = headerScratchSpace;
              headerFields.writeToBuffer(headerScratchSpace);
              headerScratchSpace.flip();
           }
           
           // build header into buffer.
           
        }
        else
        {
           // We have already built a header into the scratch space and are
           // in the process of copying it into the transmission buffer.
           headerBuffer = headerScratchSpace;
        }
  
        if (!headerFinished)
        {
           // We have not finished on this header yet.  Try copying it into
           // the transmission buffer.
           int headerLeftToCopy = headerBuffer.remaining();
           int amountCopied = JFapUtils.copyWsByteBuffer(headerBuffer, xmitBuffer, headerLeftToCopy);
           headerFinished = amountCopied == headerLeftToCopy;
        }
        
        // If we finished the header - clean out anything we might have put
        // into the scratch space.
        if (headerFinished)
        {
           headerScratchSpace.clear();
           transmissionRemaining -= headerFields.sizeof();
        }
        else
           exhausedXmitBuffer = true;
        
        if (tc.isEntryEnabled()) SibTr.exit(this, tc, "buildHeader", ""+headerFinished);
        return headerFinished;
     }