Class Utf8Old


  • public class Utf8Old
    extends Utf8
    This class implements the Utf8 API using the Java Utf8 encoder. Use Utf8.setDefault(new Utf8Old()); to use it.
    • Constructor Detail

      • Utf8Old

        public Utf8Old()
    • Method Detail

      • encodedLength

        public int encodedLength​(CharSequence in)
        Description copied from class: Utf8
        Returns the number of bytes in the UTF-8-encoded form of sequence. For a string, this method is equivalent to string.getBytes(UTF_8).length, but is more efficient in both time and space.
        Specified by:
        encodedLength in class Utf8
      • encodeUtf8

        public void encodeUtf8​(CharSequence in,
                               ByteBuffer out)
        Description copied from class: Utf8
        Encodes the given characters to the target ByteBuffer using UTF-8 encoding.

        Selects an optimal algorithm based on the type of ByteBuffer (i.e. heap or direct) and the capabilities of the platform.

        Specified by:
        encodeUtf8 in class Utf8
        Parameters:
        in - the source string to be encoded
        out - the target buffer to receive the encoded string.