# StrokeInputBatch.Companion

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

*** ** * ** ***

Common/All
- Cmn

  ```
  object StrokeInputBatch.Companion
  ```

*** ** * ** ***

## Summary

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch` | `@https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throws/index.html(exceptionClasses = [https://developer.android.com/reference/kotlin/androidx/ink/storage/IOException]) https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch.Companion.https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch.Companion#(androidx.ink.strokes.StrokeInputBatch.Companion).decode(kotlin.ByteArray)(input: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)` Read a serialized gzip-compressed `ink.proto.CodedStrokeInputBatch` 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/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch`, throwing an exception if parsing or validation was not successful. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch` | `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch.Companion.https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch.Companion#(androidx.ink.strokes.StrokeInputBatch.Companion).decode(java.io.InputStream)(input: https://developer.android.com/reference/java/io/InputStream.html)` Read a serialized gzip-compressed `ink.proto.CodedStrokeInputBatch` from the given `https://developer.android.com/reference/java/io/InputStream.html` and parse it into a `https://developer.android.com/reference/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch`, throwing an exception if parsing or validation was not successful. | android |

## Extension functions

### StrokeInputBatch.Companion.decode

Cmn 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/StrokeInputBatchExtensions.kt+function:decode)

```
@Throws(exceptionClasses = [IOException])
fun StrokeInputBatch.Companion.decode(input: ByteArray): ImmutableStrokeInputBatch
```

Read a serialized gzip-compressed `ink.proto.CodedStrokeInputBatch` 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/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch`, throwing an exception if parsing or validation was not successful.

| Parameters |
|---|---|
| `input: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` providing gzip-compressed `ink.proto.CodedStrokeInputBatch` binary proto messages, the same as written by `https://developer.android.com/reference/kotlin/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily).encode(androidx.ink.storage.TexturePngBytesLookup)`. |

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

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

### StrokeInputBatch.Companion.decode

android 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/StrokeInputBatchExtensions.jvmAndAndroid.kt+function:decode)

```
fun StrokeInputBatch.Companion.decode(input: InputStream): ImmutableStrokeInputBatch
```

Read a serialized gzip-compressed `ink.proto.CodedStrokeInputBatch` from the given `https://developer.android.com/reference/java/io/InputStream.html` and parse it into a `https://developer.android.com/reference/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch`, throwing an exception if parsing or validation was not successful. Java callers should use `https://developer.android.com/reference/kotlin/androidx/ink/storage/StrokeInputBatchSerialization#decode(java.io.InputStream)` instead.

| Parameters |
|---|---|
| `input: https://developer.android.com/reference/java/io/InputStream.html` | `https://developer.android.com/reference/java/io/InputStream.html` providing gzip-compressed `ink.proto.CodedStrokeInputBatch` binary proto messages, the same as written by `https://developer.android.com/reference/kotlin/androidx/ink/storage/package-summary#(androidx.ink.brush.BrushFamily).encode(java.io.OutputStream,androidx.ink.storage.TexturePngBytesLookup)`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch` | The `https://developer.android.com/reference/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch` 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/kotlin/androidx/ink/storage/package-summary#(androidx.ink.strokes.StrokeInputBatch.Companion).decode(java.io.InputStream)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/storage/package-summary#(androidx.ink.strokes.StrokeInputBatch.Companion).decode(java.io.InputStream)` does not provide a valid `ink.proto.CodedStrokeInputBatch` proto message, or the corresponding `https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch` is invalid. |