code: @Override
    public int write(OutputStreamWithBuffer os,
                     char []cBuf, int cOffset, int cLength)
      throws IOException
    {
      byte []bBuf = os.buffer();
      int bOffset = os.offset();
      int bEnd = bBuf.length;
  
      int cEnd = cOffset + cLength;
      // int cEnd = cOffset + cLength;
  
      while (cOffset < cEnd) {
        int sublen = Math.min(bEnd - bOffset, cEnd - cOffset);
  
        for (int i = sublen - 1; i >= 0; i--) {
          char ch = cBuf[cOffset + i];
          
          bBuf[bOffset + i] = (byte) (ch < 0x100 ? ch : 0x3f);
        }
  
        bOffset += sublen;
        cOffset += sublen;
        
        if (bOffset == bEnd && cLength > 0) {
          bBuf = os.nextBuffer(bOffset);
          bOffset = os.offset();
          bEnd = bBuf.length;
        }
      }
  
      os.offset(bOffset);
      
      return cLength;
    }
docs: Writes a character buffer using the correct encoding.
  
  @param os output stream for data.
  @param cBuf data.
  @param cOffset starting offset into the buffer.
  @param cLength number of characters to write