BrushFamilyExtensions
public final class BrushFamilyExtensions
Summary
Public methods |
|
|---|---|
static final @NonNull BrushFamily |
@Throws(exceptionClasses = [IOException])Read a serialized |
static final @NonNull BrushFamily |
decode(Read a serialized |
static final @NonNull byte[] |
encode(Write a gzip-compressed |
static final void |
encode(Write a gzip-compressed serialized |
Public methods
decode
@Throws(exceptionClasses = [IOException])
public static final @NonNull BrushFamily 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 |
|
@NonNull Version maxVersion |
The maximum |
OnDecodeTexturePngBytes onDecodeTexture |
A callback to store any decoded texture image, if any were encoded inside the serialized |
| Returns | |
|---|---|
@NonNull BrushFamily |
The |
| Throws | |
|---|---|
IllegalArgumentException |
|
IOException |
if gzip-format bytes cannot be read from |
decode
public static final @NonNull BrushFamily 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 |
|
@NonNull Version maxVersion |
The maximum |
OnDecodeTexturePngBytes onDecodeTexture |
A callback to store any decoded texture image, if any were encoded inside the serialized |
| Returns | |
|---|---|
@NonNull BrushFamily |
The |
| Throws | |
|---|---|
java.io.IOException |
if gzip-format bytes cannot be read from |
IllegalArgumentException |
|
encode
public static final @NonNull byte[] encode(
@NonNull BrushFamily receiver,
TexturePngBytesLookup textureIdToPngBytes
)
Write a gzip-compressed ink.proto.BrushFamily binary proto message representing the BrushFamily to the given ByteArray using the provided texture map represented in corresponding arrays of keys (client texture IDs) and values (PNG bytes). If BrushFamily.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.
| Parameters | |
|---|---|
TexturePngBytesLookup textureIdToPngBytes |
A callback to retrieve the PNG bytes of the texture bitmap for a given client texture ID. |
encode
public static final void encode(
@NonNull BrushFamily receiver,
@NonNull OutputStream output,
TexturePngBytesLookup textureIdToPngBytes
)
Write a gzip-compressed serialized ink.proto.BrushFamily proto message representing the BrushFamily to the given OutputStream. If BrushFamily.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.