code: public static int utf8Bytes(final CharSequence seq) {
          if (seq instanceof AsciiString) {
              return seq.length();
          }
          int seqLength = seq.length();
          int i = 0;
          // ASCII fast path
          while (i < seqLength && seq.charAt(i) < 0x80) {
              ++i;
          }
          // !ASCII is packed in a separate method to let the ASCII case be smaller
          return i < seqLength ? i + utf8Bytes(seq, i, seqLength) : i;
      }
docs: Returns the exact bytes length of UTF8 character sequence.
  <p>
  This method is producing the exact length according to {@link #writeUtf8(ByteBuf, CharSequence)}.