Package io.objectbox.flatbuffers
Class Utf8Old
- java.lang.Object
-
- io.objectbox.flatbuffers.Utf8
-
- io.objectbox.flatbuffers.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 theByteBuffer
into aString
.int
encodedLength(java.lang.CharSequence in)
Returns the number of bytes in the UTF-8-encoded form ofsequence
.void
encodeUtf8(java.lang.CharSequence in, java.nio.ByteBuffer out)
Encodes the given characters to the targetByteBuffer
using UTF-8 encoding.-
Methods inherited from class io.objectbox.flatbuffers.Utf8
encodeUtf8CodePoint, getDefault, setDefault
-
-
-
-
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 ofsequence
. For a string, this method is equivalent tostring.getBytes(UTF_8).length
, but is more efficient in both time and space.- Specified by:
encodedLength
in classUtf8
-
encodeUtf8
public void encodeUtf8(java.lang.CharSequence in, java.nio.ByteBuffer out)
Description copied from class:Utf8
Encodes the given characters to the targetByteBuffer
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 classUtf8
- Parameters:
in
- the source string to be encodedout
- 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 theByteBuffer
into aString
.- Specified by:
decodeUtf8
in classUtf8
-
-