@Override
  public void writeChars(final @NotNull String s) {
    // if (logger.isTraceEnabled()) logger.trace(" chars={}", s);

    if (overflowBuf != null) {
      overflowBuf.writeChars(s);
      return;
    }
    int len = s.length();
    int offset = 0;
    while (len > 0) {
      int remainingCharSpace = (buffer.capacity() - buffer.position()) / 2;
      if (remainingCharSpace == 0) {
        realFlush(false);
        if (overflowBuf != null) {
          overflowBuf.writeChars(s.substring(offset));
          return;
        }
      } else {
        int chunkSize = remainingCharSpace;
        if (len < chunkSize) {
          chunkSize = len;
        }
        for (int i = 0; i < chunkSize; i++) {
          buffer.putChar(s.charAt(offset + i));
        }
        offset += chunkSize;
        len -= chunkSize;
      }
    }
  }
Writes every character in the string <code>s</code>, to the output stream, in order, two bytes
per character. If <code>s</code> is <code>null</code>, a <code>NullPointerException</code> is
thrown. If <code>s.length</code> is zero, then no characters are written. Otherwise, the
character <code>s[0]</code> is written first, then <code>s[1]</code>, and so on; the last
character written is <code>s[s.length-1]</code>. For each character, two bytes are actually
written, high-order byte first, in exactly the manner of the <code>writeChar</code> method.

@param s the string value to be written.
geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java