BrushFamily.Companion


public static class BrushFamily.Companion


Summary

Public methods

static final @NonNull BrushFamily.Builder

Returns a new BrushFamily.Builder.

Extension functions

static final @NonNull BrushFamily

See decode above.

static final @NonNull BrushFamily
AndroidBrushFamilyExtensions.decode(
    @NonNull BrushFamily.Companion receiver,
    @NonNull InputStream input,
    @NonNull Version maxVersion,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

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 @NonNull BrushFamily
@Throws(exceptionClasses = [IOException])
BrushFamilyExtensions.decode(
    @NonNull BrushFamily.Companion receiver,
    @NonNull byte[] input,
    @NonNull Version maxVersion,
    OnDecodeTexturePngBytes onDecodeTexture
)

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

static final @NonNull BrushFamily
BrushFamilyExtensions.decode(
    @NonNull BrushFamily.Companion receiver,
    @NonNull InputStream input,
    @NonNull Version maxVersion,
    OnDecodeTexturePngBytes onDecodeTexture
)

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

Public methods

builder

Added in 1.1.0-alpha04
public static final @NonNull BrushFamily.Builder builder()

Returns a new BrushFamily.Builder.

Extension functions

AndroidBrushFamilyExtensions.decode

public static final @NonNull BrushFamily AndroidBrushFamilyExtensions.decode(
    @NonNull BrushFamily.Companion receiver,
    @NonNull InputStream input,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

See decode above. This overload uses Version.MAX_SUPPORTED.

AndroidBrushFamilyExtensions.decode

public static final @NonNull BrushFamily AndroidBrushFamilyExtensions.decode(
    @NonNull BrushFamily.Companion receiver,
    @NonNull InputStream input,
    @NonNull Version maxVersion,
    @NonNull BrushFamilyDecodeCallback getClientTextureId
)

Read a serialized BrushFamily from the given InputStream and parse it into a BrushFamily, throwing an exception if parsing or validation was not successful. Java callers should use AndroidBrushFamilySerialization.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 to be supported by the deserializer. Proto objects with a min_version of greater than maxVersion will be rejected.

@NonNull BrushFamilyDecodeCallback getClientTextureId

A callback to store the decoded texture image, if one were encoded inside the serialized BrushFamily, into a TextureBitmapStore. This is called synchronously as part of this function call on the same thread.

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.

BrushFamilyExtensions.decode

@Throws(exceptionClasses = [IOException])
public static final @NonNull BrushFamily BrushFamilyExtensions.decode(
    @NonNull BrushFamily.Companion receiver,
    @NonNull byte[] input,
    @NonNull Version maxVersion,
    OnDecodeTexturePngBytes onDecodeTexture
)

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

Parameters
@NonNull byte[] input

ByteArray providing gzip-compressed ink.proto.BrushFamily binary proto messages, the same as written 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.

OnDecodeTexturePngBytes onDecodeTexture

A callback to store any decoded texture image, if any were encoded inside the serialized BrushFamily. This is called synchronously as part of this function call, on the same thread, once for each texture image.

Returns
@NonNull BrushFamily

The BrushFamily parsed from the ByteArray.

Throws
IllegalArgumentException

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

IOException

if gzip-format bytes cannot be read from input.

BrushFamilyExtensions.decode

public static final @NonNull BrushFamily BrushFamilyExtensions.decode(
    @NonNull BrushFamily.Companion receiver,
    @NonNull InputStream input,
    @NonNull Version maxVersion,
    OnDecodeTexturePngBytes onDecodeTexture
)

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

Parameters
@NonNull InputStream input

InputStream providing gzip-compressed ink.proto.BrushFamily binary proto messages, the same as written 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.

OnDecodeTexturePngBytes onDecodeTexture

A callback to store any decoded texture image, if any were encoded inside the serialized BrushFamily. This is called synchronously as part of this function call, on the same thread, once for each texture image.

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.