BundleableByteArray


@UnstableApi
class BundleableByteArray


A wrapper for byte arrays that allows them to be transferred over Bundle instances using shared memory.

This class should be used for transferring byte arrays whose size is not trivially small, e.g. below 5000 bytes, to ensure it stays well below the binder transaction limits.

Summary

Public constructors

Creates the bundleable byte array.

Public functions

java-static ByteArray<Byte>?
fromBundle(bundle: Bundle!)

Reads a bundleable byte array from a Bundle.

Bundle!

Writes a reference to the byte array to a Bundle.

Public constructors

BundleableByteArray

BundleableByteArray(byteArray: ByteArray!)

Creates the bundleable byte array.

Parameters
byteArray: ByteArray!

The byte array to wrap. This class assumes this array will not be modified after being passed to this constructor.

Public functions

fromBundle

java-static fun fromBundle(bundle: Bundle!): ByteArray<Byte>?

Reads a bundleable byte array from a Bundle.

Parameters
bundle: Bundle!

The Bundle to read from.

Returns
ByteArray<Byte>?

The bundleable byte array, or null if the key is not present or malformed.

toBundle

fun toBundle(): Bundle!

Writes a reference to the byte array to a Bundle.