AndroidBrushFamilySerialization



Summary

Public functions

BrushFamily?
decodeOrNull(
    input: InputStream,
    getClientTextureId: BrushFamilyDecodeCallback
)

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

android
BrushFamily
decodeOrThrow(
    input: InputStream,
    getClientTextureId: BrushFamilyDecodeCallback
)

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

android
Unit
encode(
    brushFamily: BrushFamily,
    output: OutputStream,
    textureBitmapStore: TextureBitmapStore
)

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

android

Public functions

decodeOrNull

fun decodeOrNull(
    input: InputStream,
    getClientTextureId: BrushFamilyDecodeCallback
): BrushFamily?

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

fun decodeOrThrow(
    input: InputStream,
    getClientTextureId: BrushFamilyDecodeCallback
): BrushFamily

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

fun encode(
    brushFamily: BrushFamily,
    output: OutputStream,
    textureBitmapStore: TextureBitmapStore
): Unit

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