BrushFamilySerialization


public static class BrushFamilySerialization


Summary

Public fields

static @NonNull BrushFamilySerialization

Public methods

static final @NonNull BrushFamily
decode(@NonNull InputStream input, @NonNull Version maxVersion)

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

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

Write a gzip-compressed serialized ink.proto.BrushFamily proto message representing the BrushFamily to the given OutputStream.

Public fields

INSTANCE

Added in 1.0.0
public static @NonNull BrushFamilySerialization INSTANCE

Public methods

decode

Added in 1.1.0-alpha02
public static final @NonNull BrushFamily decode(@NonNull InputStream input, @NonNull Version maxVersion)

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, throwing an exception if parsing or validation was not successful. Kotlin callers should use BrushFamily.Companion.decode instead.

Parameters
@NonNull InputStream input

InputStream providing gzip-compressed ink.proto.BrushFamily binary proto messages, the same as written to OutputStream by encode.

@NonNull Version maxVersion

The maximum Version supported by the deserializer. Proto objects with a min_version of greater than maxVersion will be rejected.

Returns
@NonNull BrushFamily

The BrushFamily parsed from the InputStream.

Throws
java.io.IOException

if gzip-format bytes cannot be read from input.

IllegalArgumentException

input does not provide a valid ink.proto.BrushFamily proto message, or the corresponding BrushFamily is invalid.

encode

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

Write a gzip-compressed serialized ink.proto.BrushFamily proto message representing the BrushFamily to the given OutputStream. If hasFallbacks is true, then the stored proto message including fallbacks for this BrushFamily will be used instead of recomputing the proto from the BrushFamily object.