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 Summary

      Constructors 
      Constructor Description
      Utf8Old()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String decodeUtf8​(java.nio.ByteBuffer buffer, int offset, int length)
      Decodes the given UTF-8 portion of the ByteBuffer into a String.
      int encodedLength​(java.lang.CharSequence in)
      Returns the number of bytes in the UTF-8-encoded form of sequence.
      void encodeUtf8​(java.lang.CharSequence in, java.nio.ByteBuffer out)
      Encodes the given characters to the target ByteBuffer using UTF-8 encoding.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utf8Old

        public Utf8Old()
    • Method Detail

      • encodedLength

        public int encodedLength​(java.lang.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​(java.lang.CharSequence in,
                               java.nio.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.
      • decodeUtf8

        public java.lang.String decodeUtf8​(java.nio.ByteBuffer buffer,
                                           int offset,
                                           int length)
        Description copied from class: Utf8
        Decodes the given UTF-8 portion of the ByteBuffer into a String.
        Specified by:
        decodeUtf8 in class Utf8