5package io.flutter.plugin.common;
7import androidx.annotation.NonNull;
8import androidx.annotation.Nullable;
9import io.flutter.BuildConfig;
11import java.io.ByteArrayOutputStream;
12import java.math.BigInteger;
13import java.nio.ByteBuffer;
14import java.nio.ByteOrder;
15import java.nio.charset.Charset;
16import java.util.ArrayList;
17import java.util.HashMap;
20import java.util.Map.Entry;
66 private static final String TAG =
"StandardMessageCodec#";
77 final ByteBuffer
buffer = ByteBuffer.allocateDirect(
stream.size());
88 message.order(ByteOrder.nativeOrder());
91 throw new IllegalArgumentException(
"Message corrupted");
96 private static final boolean LITTLE_ENDIAN = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN;
97 private static final Charset UTF8 = Charset.forName(
"UTF8");
98 private static final byte NULL = 0;
99 private static final byte TRUE = 1;
100 private static final byte FALSE = 2;
101 private static final byte INT = 3;
102 private static final byte LONG = 4;
103 private static final byte BIGINT = 5;
104 private static final byte DOUBLE = 6;
105 private static final byte STRING = 7;
106 private static final byte BYTE_ARRAY = 8;
107 private static final byte INT_ARRAY = 9;
108 private static final byte LONG_ARRAY = 10;
109 private static final byte DOUBLE_ARRAY = 11;
110 private static final byte LIST = 12;
111 private static final byte MAP = 13;
112 private static final byte FLOAT_ARRAY = 14;
120 Log.
e(
TAG,
"Attempted to write a negative size.");
124 }
else if (
value <= 0xffff) {
194 @NonNull ByteArrayOutputStream
stream, @NonNull
byte[] bytes) {
196 stream.write(bytes, 0, bytes.length);
205 final int mod =
stream.size() % alignment;
207 for (
int i = 0;
i < alignment - mod;
i++) {
223 }
else if (
value instanceof Boolean) {
225 }
else if (
value instanceof Number) {
226 if (
value instanceof Integer ||
value instanceof Short ||
value instanceof Byte) {
229 }
else if (
value instanceof Long) {
232 }
else if (
value instanceof Float ||
value instanceof Double) {
236 }
else if (
value instanceof BigInteger) {
240 throw new IllegalArgumentException(
"Unsupported Number type: " +
value.getClass());
242 }
else if (
value instanceof CharSequence) {
245 }
else if (
value instanceof
byte[]) {
248 }
else if (
value instanceof
int[]) {
250 final int[] array = (
int[])
value;
253 for (
final int n : array) {
256 }
else if (
value instanceof
long[]) {
258 final long[] array = (
long[])
value;
261 for (
final long n : array) {
264 }
else if (
value instanceof
double[]) {
265 stream.write(DOUBLE_ARRAY);
266 final double[] array = (
double[])
value;
269 for (
final double d : array) {
276 for (
final Object o : list) {
279 }
else if (
value instanceof Map) {
283 for (
final Entry<?, ?> entry :
map.entrySet()) {
287 }
else if (
value instanceof
float[]) {
288 stream.write(FLOAT_ARRAY);
289 final float[] array = (
float[])
value;
292 for (
final float f : array) {
296 throw new IllegalArgumentException(
297 "Unsupported value: '" +
value +
"' of type '" +
value.getClass() +
"'");
303 if (!
buffer.hasRemaining()) {
304 throw new IllegalArgumentException(
"Message corrupted");
309 }
else if (
value == 254) {
320 final byte[] bytes =
new byte[
length];
327 final int mod =
buffer.position() % alignment;
336 if (!
buffer.hasRemaining()) {
337 throw new IllegalArgumentException(
"Message corrupted");
371 result =
new BigInteger(
new String(hex, UTF8), 16);
381 result =
new String(bytes, UTF8);
392 final int[] array =
new int[
length];
394 buffer.asIntBuffer().get(array);
402 final long[] array =
new long[
length];
404 buffer.asLongBuffer().get(array);
412 final double[] array =
new double[
length];
414 buffer.asDoubleBuffer().get(array);
423 for (
int i = 0;
i <
size;
i++) {
432 final Map<Object, Object>
map =
new HashMap<>();
433 for (
int i = 0;
i <
size;
i++) {
442 final float[] array =
new float[
length];
444 buffer.asFloatBuffer().get(array);
450 throw new IllegalArgumentException(
"Message corrupted");
SkIDChangeListener::List List
static final boolean DEBUG
static void e(@NonNull String tag, @NonNull String message)
ByteBuffer encodeMessage(@Nullable Object message)
Object readValueOfType(byte type, @NonNull ByteBuffer buffer)
final Object readValue(@NonNull ByteBuffer buffer)
static final void writeInt(@NonNull ByteArrayOutputStream stream, int value)
static final void writeSize(@NonNull ByteArrayOutputStream stream, int value)
static final void writeChar(@NonNull ByteArrayOutputStream stream, int value)
static final void writeFloat(@NonNull ByteArrayOutputStream stream, float value)
static final void writeAlignment(@NonNull ByteArrayOutputStream stream, int alignment)
void writeValue(@NonNull ByteArrayOutputStream stream, @Nullable Object value)
static final void readAlignment(@NonNull ByteBuffer buffer, int alignment)
static final StandardMessageCodec INSTANCE
static final int readSize(@NonNull ByteBuffer buffer)
static final void writeLong(@NonNull ByteArrayOutputStream stream, long value)
static final void writeBytes( @NonNull ByteArrayOutputStream stream, @NonNull byte[] bytes)
Object decodeMessage(@Nullable ByteBuffer message)
static final void writeDouble(@NonNull ByteArrayOutputStream stream, double value)
static final byte[] readBytes(@NonNull ByteBuffer buffer)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
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
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>