> Documentation index: https://developer.android.com/reference/llms.txt

# BrushFamily.Companion

Artifact: [androidx.ink:ink-brush](https://developer.android.com/jetpack/androidx/releases/ink.md.txt) [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.md.txt#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  object BrushFamily.Companion
  ```

*** ** * ** ***

## Summary

| ### Public functions |
|---|---|---|
| `BrushFamily.Builder` | `builder()` Returns a new `BrushFamily.Builder`. | Cmn |

| ### Extension functions |
|---|---|---|
| `BrushFamily` | `BrushFamily.Companion.decode( input: InputStream, getClientTextureId: BrushFamilyDecodeCallback )` See `decode` above. | android |
| `BrushFamily` | `BrushFamily.Companion.decode( input: InputStream, maxVersion: Version, getClientTextureId: BrushFamilyDecodeCallback )` Read a serialized `BrushFamily` from the given `InputStream` and parse it into a `BrushFamily`, throwing an exception if parsing or validation was not successful. | android |
| `BrushFamily` | `@Throws(exceptionClasses = [IOException]) BrushFamily.Companion.decode( input: ByteArray, maxVersion: Version, onDecodeTexture: OnDecodeTexturePngBytes? )` Read a serialized `BrushFamily` from the given `ByteArray` and parse it into a `BrushFamily`, throwing an exception if parsing or validation was not successful. | Cmn |
| `BrushFamily` | `BrushFamily.Companion.decode( input: InputStream, maxVersion: Version, onDecodeTexture: OnDecodeTexturePngBytes? )` Read a serialized `BrushFamily` from the given `InputStream` and parse it into a `BrushFamily`, throwing an exception if parsing or validation was not successful. | android |
| `BrushFamily` | `BrushFamily.Companion.decode( input: ByteArray, onDecodeTexture: OnDecodeTextureUiImage )` See `decode` above. | N |
| `BrushFamily` | `BrushFamily.Companion.decode( input: ByteArray, maxVersion: Version, onDecodeTexture: OnDecodeTextureUiImage )` Read a serialized `BrushFamily` from the given `ByteArray` and parse it into a `BrushFamily`, throwing an exception if parsing or validation was not successful. | N |

## Public functions

### builder

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

```
fun builder(): BrushFamily.Builder
```

Returns a new `BrushFamily.Builder`.

## Extension functions

### BrushFamily.Companion.decode

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

```
fun BrushFamily.Companion.decode(
    input: InputStream,
    getClientTextureId: BrushFamilyDecodeCallback
): BrushFamily
```

See `decode` above. This overload uses `Version.MAX_SUPPORTED`.

### BrushFamily.Companion.decode

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

```
fun BrushFamily.Companion.decode(
    input: InputStream,
    maxVersion: Version,
    getClientTextureId: BrushFamilyDecodeCallback
): BrushFamily
```

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 |
|---|---|
| `input: InputStream` | `InputStream` providing gzip-compressed `ink.proto.BrushFamily` binary proto messages, the same as written to `OutputStream` by `encode`. |
| `maxVersion: Version` | The maximum `Version` to be supported by the deserializer. Proto objects with a `min_version` of greater than maxVersion will be rejected. |
| `getClientTextureId: BrushFamilyDecodeCallback` | 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 |
|---|---|
| `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. |

### BrushFamily.Companion.decode

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

```
@Throws(exceptionClasses = [IOException])
fun BrushFamily.Companion.decode(
    input: ByteArray,
    maxVersion: Version = Version.MAX_SUPPORTED,
    onDecodeTexture: OnDecodeTexturePngBytes? = null
): BrushFamily
```

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 |
|---|---|
| `input: ByteArray` | `ByteArray` providing gzip-compressed `ink.proto.BrushFamily` binary proto messages, the same as written by `encode`. |
| `maxVersion: Version = Version.MAX_SUPPORTED` | The maximum `Version` supported by the deserializer. Proto objects with a `min_version` of greater than maxVersion will be rejected. |
| `onDecodeTexture: OnDecodeTexturePngBytes? = null` | 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 |
|---|---|
| `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`. |

### BrushFamily.Companion.decode

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

```
fun BrushFamily.Companion.decode(
    input: InputStream,
    maxVersion: Version = Version.MAX_SUPPORTED,
    onDecodeTexture: OnDecodeTexturePngBytes? = null
): BrushFamily
```

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 |
|---|---|
| `input: InputStream` | `InputStream` providing gzip-compressed `ink.proto.BrushFamily` binary proto messages, the same as written by `encode`. |
| `maxVersion: Version = Version.MAX_SUPPORTED` | The maximum `Version` supported by the deserializer. Proto objects with a `min_version` of greater than maxVersion will be rejected. |
| `onDecodeTexture: OnDecodeTexturePngBytes? = null` | 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 |
|---|---|
| `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. |

### BrushFamily.Companion.decode

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

```
fun BrushFamily.Companion.decode(
    input: ByteArray,
    onDecodeTexture: OnDecodeTextureUiImage
): BrushFamily
```

See `decode` above. This overload uses `Version.MAX_SUPPORTED`.

### BrushFamily.Companion.decode

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

```
fun BrushFamily.Companion.decode(
    input: ByteArray,
    maxVersion: Version,
    onDecodeTexture: OnDecodeTextureUiImage
): BrushFamily
```

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 |
|---|---|
| `input: ByteArray` | `ByteArray` providing gzip-compressed `ink.proto.BrushFamily` binary proto messages, the same as written by `encode`. |
| `maxVersion: Version` | The maximum `Version` to be supported by the deserializer. Proto objects with a `min_version` of greater than maxVersion will be rejected. |
| `onDecodeTexture: OnDecodeTextureUiImage` | A callback to store the decoded texture image, if one were encoded inside the serialized `BrushFamily`, into a `TextureImageStore`. This is called synchronously as part of this function call on the same thread. |

| Returns |
|---|---|
| `BrushFamily` | The `BrushFamily` parsed from the `ByteArray`. |

| Throws |
|---|---|
| `okio.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. |