Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Attributes | List of all members
io.flutter.plugin.common.StringCodec Class Reference
Inheritance diagram for io.flutter.plugin.common.StringCodec:
io.flutter.plugin.common.MessageCodec< String >

Public Member Functions

ByteBuffer encodeMessage (@Nullable String message)
 
String decodeMessage (@Nullable ByteBuffer message)
 
- Public Member Functions inherited from io.flutter.plugin.common.MessageCodec< String >
ByteBuffer encodeMessage ( @Nullable T message)
 
T decodeMessage ( @Nullable ByteBuffer message)
 

Static Public Attributes

static final StringCodec INSTANCE = new StringCodec()
 

Detailed Description

A MessageCodec using UTF-8 encoded String messages.

This codec is guaranteed to be compatible with the corresponding StringCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

Definition at line 18 of file StringCodec.java.

Member Function Documentation

◆ decodeMessage()

String io.flutter.plugin.common.StringCodec.decodeMessage ( @Nullable ByteBuffer  message)
inline

Definition at line 39 of file StringCodec.java.

39 {
40 if (message == null) {
41 return null;
42 }
43 final byte[] bytes;
44 final int offset;
45 final int length = message.remaining();
46 if (message.hasArray()) {
47 bytes = message.array();
48 offset = message.arrayOffset();
49 } else {
50 // TODO(mravn): Avoid the extra copy below.
51 bytes = new byte[length];
52 message.get(bytes);
53 offset = 0;
54 }
55 return new String(bytes, offset, length, UTF8);
56 }
size_t length
Win32Message message
SeparatedVector2 offset

◆ encodeMessage()

ByteBuffer io.flutter.plugin.common.StringCodec.encodeMessage ( @Nullable String  message)
inline

Definition at line 26 of file StringCodec.java.

26 {
27 if (message == null) {
28 return null;
29 }
30 // TODO(mravn): Avoid the extra copy below.
31 final byte[] bytes = message.getBytes(UTF8);
32 final ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.length);
33 buffer.put(bytes);
34 return buffer;
35 }
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

Member Data Documentation

◆ INSTANCE

final StringCodec io.flutter.plugin.common.StringCodec.INSTANCE = new StringCodec()
static

Definition at line 20 of file StringCodec.java.


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