| FlatBuffers An open source project by FPL.

Classes | Public Member Functions | Static Public Member Functions | List of all members
com.google.flatbuffers.Utf8 Class Referenceabstract
Inheritance diagram for com.google.flatbuffers.Utf8:

## Classes
class | DecodeUtil
| Utility methods for decoding bytes into `String`.
class | UnpairedSurrogateException

## Public Member Functions
abstract String | decodeUtf8 (ByteBuffer buffer, int offset, int length)
| Decodes the given UTF-8 portion of the `ByteBuffer` into a `String`. More...
abstract int | encodedLength (CharSequence sequence)
| Returns the number of bytes in the UTF-8-encoded form of `sequence`. More...
abstract void | encodeUtf8 (CharSequence in, ByteBuffer out)
| Encodes the given characters to the target `ByteBuffer` using UTF-8 encoding. More...

## Static Public Member Functions
static Utf8 | getDefault ()
| Get the default UTF-8 processor. More...
static void | setDefault (Utf8 instance)
| Set the default instance of the UTF-8 processor. More...

## Member Function Documentation

## ◆ decodeUtf8()

abstract String com.google.flatbuffers.Utf8.decodeUtf8 | ( | ByteBuffer | buffer,
|  | int | offset,
|  | int | length
| ) |  |
| abstract

Decodes the given UTF-8 portion of the `ByteBuffer` into a `String`.

Exceptions

  IllegalArgumentException | if the input is not valid UTF-8.

Reimplemented in com.google.flatbuffers.Utf8Old, and com.google.flatbuffers.Utf8Safe.

## ◆ encodedLength()

abstract int com.google.flatbuffers.Utf8.encodedLength | ( | CharSequence | sequence | ) |
| abstract

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.

Exceptions

  IllegalArgumentException | if `sequence` contains ill-formed UTF-16 (unpaired surrogates)

Reimplemented in com.google.flatbuffers.Utf8Old, and com.google.flatbuffers.Utf8Safe.

## ◆ encodeUtf8()

abstract void com.google.flatbuffers.Utf8.encodeUtf8 | ( | CharSequence | in,
|  | ByteBuffer | out
| ) |  |
| abstract

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.

Parameters

  in | the source string to be encoded
  out | the target buffer to receive the encoded string.

Reimplemented in com.google.flatbuffers.Utf8Old, and com.google.flatbuffers.Utf8Safe.

## ◆ getDefault()

static Utf8 com.google.flatbuffers.Utf8.getDefault | ( |  | ) |
| inline static

Get the default UTF-8 processor.

Returns
  the default processor

## ◆ setDefault()

static void com.google.flatbuffers.Utf8.setDefault | ( | Utf8 | instance | ) |
| inline static

Set the default instance of the UTF-8 processor.

Parameters

  instance | the new instance to use

The documentation for this class was generated from the following file:

- Utf8.java