Package io.objectbox.flatbuffers
Class Utf8Old
java.lang.Object
io.objectbox.flatbuffers.Utf8
io.objectbox.flatbuffers.Utf8Old
This class implements the Utf8 API using the Java Utf8 encoder. Use
Utf8.setDefault(new Utf8Old()); to use it.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodeUtf8
(ByteBuffer buffer, int offset, int length) Decodes the given UTF-8 portion of theByteBuffer
into aString
.int
Returns the number of bytes in the UTF-8-encoded form ofsequence
.void
encodeUtf8
(CharSequence in, ByteBuffer out) Encodes the given characters to the targetByteBuffer
using UTF-8 encoding.Methods inherited from class io.objectbox.flatbuffers.Utf8
encodeUtf8CodePoint, getDefault, setDefault
-
Constructor Details
-
Utf8Old
public Utf8Old()
-
-
Method Details
-
encodedLength
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
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
Description copied from class:Utf8
Decodes the given UTF-8 portion of theByteBuffer
into aString
.- Specified by:
decodeUtf8
in classUtf8
-