AndroidBrushFamilySerialization


@ExperimentalInkCustomBrushApi
public static class AndroidBrushFamilySerialization


Summary

Public methods

static final BrushFamily
decodeOrNull(
    @NonNull InputStream input,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, returning null if parsing was not successful.

static final @NonNull BrushFamily
decodeOrThrow(
    @NonNull InputStream input,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, throwing an exception if parsing was not successful.

static final void
encode(
    @NonNull BrushFamily brushFamily,
    @NonNull OutputStream output,
    @NonNull TextureBitmapStore textureBitmapStore
)

Write the gzip-compressed serialized representation of the BrushFamily to the given OutputStream.

Public fields

INSTANCE

Added in 1.0.0-alpha04
public static @NonNull AndroidBrushFamilySerialization INSTANCE

Public methods

decodeOrNull

Added in 1.0.0-alpha04
public static final BrushFamily decodeOrNull(
    @NonNull InputStream input,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, returning null if parsing was not successful. The serialized representation is gzip-compressed ink.proto.BrushFamily binary proto messages, the same as written to OutputStream by encode. Kotlin callers should use BrushFamily.Companion.decodeOrNull instead.

getClientTextureId is called synchronously as part of this function call, on the same thread.

decodeOrThrow

Added in 1.0.0-alpha04
public static final @NonNull BrushFamily decodeOrThrow(
    @NonNull InputStream input,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, throwing an exception if parsing was not successful. The serialized representation is gzip-compressed ink.proto.BrushFamily binary proto messages, the same as written to OutputStream by encode. Kotlin callers should use BrushFamily.Companion.decodeOrThrow instead.

getClientTextureId is called synchronously as part of this function call, on the same thread.

encode

Added in 1.0.0-alpha04
public static final void encode(
    @NonNull BrushFamily brushFamily,
    @NonNull OutputStream output,
    @NonNull TextureBitmapStore textureBitmapStore
)

Write the gzip-compressed serialized representation of the BrushFamily to the given OutputStream. Kotlin callers should use BrushFamily.encode instead.