# BrushFamily.Companion

Artifact: [androidx.ink:ink-brush](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/brush/BrushFamily.kt+class:androidx.ink.brush.BrushFamily.Companion) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***


```
public static class BrushFamily.Companion
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Builder` | `https://developer.android.com/reference/androidx/ink/brush/BrushFamily#builder()()` Returns a new `https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Builder`. |

| ### Extension functions |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/androidx/ink/brush/AndroidBrushFamilyExtensions.https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Companion#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.storage.BrushFamilyDecodeCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Companion receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/InputStream.html input, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/storage/BrushFamilyDecodeCallback getClientTextureId )` See `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.storage.BrushFamilyDecodeCallback)` above. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/androidx/ink/brush/AndroidBrushFamilyExtensions.https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Companion#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.brush.Version,androidx.ink.storage.BrushFamilyDecodeCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Companion receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/InputStream.html input, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version maxVersion, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/storage/BrushFamilyDecodeCallback getClientTextureId )` Read a serialized `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` from the given `https://developer.android.com/reference/java/io/InputStream.html` and parse it into a `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`, throwing an exception if parsing or validation was not successful. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `@https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throws/index.html(exceptionClasses = [https://developer.android.com/reference/androidx/ink/storage/IOException]) https://developer.android.com/reference/androidx/ink/brush/BrushFamilyExtensions.https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Companion#(androidx.ink.brush.BrushFamily.Companion).decode(kotlin.ByteArray,androidx.ink.brush.Version,androidx.ink.storage.OnDecodeTexturePngBytes)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Companion receiver, @https://developer.android.com/reference/androidx/annotation/NonNull byte[] input, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version maxVersion, https://developer.android.com/reference/androidx/ink/storage/OnDecodeTexturePngBytes onDecodeTexture )` Read a serialized `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` from the given `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` and parse it into a `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`, throwing an exception if parsing or validation was not successful. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | `https://developer.android.com/reference/androidx/ink/brush/BrushFamilyExtensions.https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Companion#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.brush.Version,androidx.ink.storage.OnDecodeTexturePngBytes)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Companion receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/InputStream.html input, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version maxVersion, https://developer.android.com/reference/androidx/ink/storage/OnDecodeTexturePngBytes onDecodeTexture )` Read a serialized `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` from the given `https://developer.android.com/reference/java/io/InputStream.html` and parse it into a `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`, throwing an exception if parsing or validation was not successful. |

## Public methods

### builder

Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

```
public static final @NonNull BrushFamily.Builder builder()
```

Returns a new `https://developer.android.com/reference/androidx/ink/brush/BrushFamily.Builder`.

## Extension functions

### AndroidBrushFamilyExtensions.decode

Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/AndroidBrushFamilyExtensions.android.kt+function:decode)

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

See `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.storage.BrushFamilyDecodeCallback)` above. This overload uses `https://developer.android.com/reference/androidx/ink/brush/Version#MAX_SUPPORTED()`.

### AndroidBrushFamilyExtensions.decode

Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/AndroidBrushFamilyExtensions.android.kt+function:decode)

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

Read a serialized `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` from the given `https://developer.android.com/reference/java/io/InputStream.html` and parse it into a `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`, throwing an exception if parsing or validation was not successful. Java callers should use `https://developer.android.com/reference/androidx/ink/storage/AndroidBrushFamilySerialization#decode(java.io.InputStream,androidx.ink.brush.Version,androidx.ink.storage.BrushFamilyDecodeCallback)` instead.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/InputStream.html input` | `https://developer.android.com/reference/java/io/InputStream.html` providing gzip-compressed `ink.proto.BrushFamily` binary proto messages, the same as written to `https://developer.android.com/reference/java/io/OutputStream.html` by `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily).encode(java.io.OutputStream,androidx.ink.brush.TextureBitmapStore)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version maxVersion` | The maximum `https://developer.android.com/reference/androidx/ink/brush/Version` to be supported by the deserializer. Proto objects with a `min_version` of greater than maxVersion will be rejected. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/storage/BrushFamilyDecodeCallback getClientTextureId` | A callback to store the decoded texture image, if one were encoded inside the serialized `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`, into a `https://developer.android.com/reference/androidx/ink/brush/TextureBitmapStore`. This is called synchronously as part of this function call on the same thread. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | The `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` parsed from the `https://developer.android.com/reference/java/io/InputStream.html`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | if gzip-format bytes cannot be read from `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.brush.Version,androidx.ink.storage.BrushFamilyDecodeCallback)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.brush.Version,androidx.ink.storage.BrushFamilyDecodeCallback)` does not provide a valid `ink.proto.BrushFamily` proto message, or the corresponding `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` is invalid. |

### BrushFamilyExtensions.decode

Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/BrushFamilyExtensions.kt+function: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 `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` from the given `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` and parse it into a `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`, throwing an exception if parsing or validation was not successful.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull byte[] input` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` providing gzip-compressed `ink.proto.BrushFamily` binary proto messages, the same as written by `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily).encode(androidx.ink.storage.TexturePngBytesLookup)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version maxVersion` | The maximum `https://developer.android.com/reference/androidx/ink/brush/Version` supported by the deserializer. Proto objects with a `min_version` of greater than maxVersion will be rejected. |
| `https://developer.android.com/reference/androidx/ink/storage/OnDecodeTexturePngBytes onDecodeTexture` | A callback to store any decoded texture image, if any were encoded inside the serialized `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`. This is called synchronously as part of this function call, on the same thread, once for each texture image. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | The `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` parsed from the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily.Companion).decode(kotlin.ByteArray,androidx.ink.brush.Version,androidx.ink.storage.OnDecodeTexturePngBytes)` does not provide a valid `ink.proto.BrushFamily` proto message, or the corresponding `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` is invalid. |
| `https://developer.android.com/reference/androidx/ink/storage/IOException` | if gzip-format bytes cannot be read from `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily.Companion).decode(kotlin.ByteArray,androidx.ink.brush.Version,androidx.ink.storage.OnDecodeTexturePngBytes)`. |

### BrushFamilyExtensions.decode

Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/BrushFamilyExtensions.jvmAndAndroid.kt+function:decode)

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

Read a serialized `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` from the given `https://developer.android.com/reference/java/io/InputStream.html` and parse it into a `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`, throwing an exception if parsing or validation was not successful. Java callers should use `https://developer.android.com/reference/androidx/ink/storage/BrushFamilySerialization#decode(java.io.InputStream,androidx.ink.brush.Version,androidx.ink.storage.OnDecodeTexturePngBytes)` instead.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/InputStream.html input` | `https://developer.android.com/reference/java/io/InputStream.html` providing gzip-compressed `ink.proto.BrushFamily` binary proto messages, the same as written by `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily).encode(java.io.OutputStream,androidx.ink.storage.TexturePngBytesLookup)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/Version maxVersion` | The maximum `https://developer.android.com/reference/androidx/ink/brush/Version` supported by the deserializer. Proto objects with a `min_version` of greater than maxVersion will be rejected. |
| `https://developer.android.com/reference/androidx/ink/storage/OnDecodeTexturePngBytes onDecodeTexture` | A callback to store any decoded texture image, if any were encoded inside the serialized `https://developer.android.com/reference/androidx/ink/brush/BrushFamily`. This is called synchronously as part of this function call, on the same thread, once for each texture image. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/brush/BrushFamily` | The `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` parsed from the `https://developer.android.com/reference/java/io/InputStream.html`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | if gzip-format bytes cannot be read from `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.brush.Version,androidx.ink.storage.OnDecodeTexturePngBytes)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily.Companion).decode(java.io.InputStream,androidx.ink.brush.Version,androidx.ink.storage.OnDecodeTexturePngBytes)` does not provide a valid `ink.proto.BrushFamily` proto message, or the corresponding `https://developer.android.com/reference/androidx/ink/brush/BrushFamily` is invalid. |