# PartitionedMeshSerialization

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/PartitionedMeshExtensions.jvmAndAndroid.kt+class:androidx.ink.storage.PartitionedMeshSerialization) Added in [1.1.0-alpha11](https://developer.android.com/jetpack/androidx/releases/ink#1.1.0-alpha11)

*** ** * ** ***


```
public static class PartitionedMeshSerialization
```

<br />

*** ** * ** ***

## Summary

| ### Public fields |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization` | `https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization#INSTANCE()` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` | `https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization#decode(kotlin.ByteArray)(@https://developer.android.com/reference/androidx/annotation/NonNull byte[] input)` Read a serialized gzip-compressed `ink.proto.CodedModeledShape` 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/geometry/PartitionedMesh`, 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/geometry/PartitionedMesh` | `https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization#decode(java.io.InputStream)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/InputStream.html input)` Read a serialized gzip-compressed `ink.proto.CodedModeledShape` from the given `https://developer.android.com/reference/java/io/InputStream.html` and parse it into a `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh`, throwing an exception if parsing or validation was not successful. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull byte[]` | `https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization#encode(androidx.ink.geometry.PartitionedMesh)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh partitionedMesh)` Write a gzip-compressed `ink.proto.CodedModeledShape` binary proto message representing the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` to a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html`. |
| `static final void` | `https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization#encode(androidx.ink.geometry.PartitionedMesh,java.io.OutputStream)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh partitionedMesh, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/OutputStream.html output )` Write a gzip-compressed `ink.proto.CodedModeledShape` binary proto message representing the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` to the given `https://developer.android.com/reference/java/io/OutputStream.html`. |

## Public fields

### INSTANCE

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

```
public static @NonNull PartitionedMeshSerialization INSTANCE
```

## Public methods

### decode

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

```
public static final @NonNull PartitionedMesh decode(@NonNull byte[] input)
```

Read a serialized gzip-compressed `ink.proto.CodedModeledShape` 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/geometry/PartitionedMesh`, throwing an exception if parsing or validation was not successful. Kotlin callers should use `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.geometry.PartitionedMesh.Companion).decode(java.io.InputStream)` instead.

| 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.CodedModeledShape` binary proto messages, the same as written by `https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization#encode(androidx.ink.geometry.PartitionedMesh,java.io.OutputStream)`. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` | The `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` parsed from the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.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/PartitionedMeshSerialization#decode(kotlin.ByteArray)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | `https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization#decode(kotlin.ByteArray)` does not provide a valid `ink.proto.CodedModeledShape` proto message, or the corresponding `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` is invalid. |

### decode

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

```
public static final @NonNull PartitionedMesh decode(@NonNull InputStream input)
```

Read a serialized gzip-compressed `ink.proto.CodedModeledShape` from the given `https://developer.android.com/reference/java/io/InputStream.html` and parse it into a `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh`, throwing an exception if parsing or validation was not successful. Kotlin callers should use `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.geometry.PartitionedMesh.Companion).decode(java.io.InputStream)` 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.CodedModeledShape` 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/PartitionedMeshSerialization#encode(androidx.ink.geometry.PartitionedMesh,java.io.OutputStream)`. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` | The `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` 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/PartitionedMeshSerialization#decode(java.io.InputStream)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | `https://developer.android.com/reference/androidx/ink/storage/PartitionedMeshSerialization#decode(java.io.InputStream)` does not provide a valid `ink.proto.CodedModeledShape` proto message, or the corresponding `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` is invalid. |

### encode

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

```
public static final @NonNull byte[] encode(@NonNull PartitionedMesh partitionedMesh)
```

Write a gzip-compressed `ink.proto.CodedModeledShape` binary proto message representing the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` to a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html`. Kotlin callers should use `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.geometry.PartitionedMesh).encode(java.io.OutputStream)` instead.

### encode

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

```
public static final void encode(
    @NonNull PartitionedMesh partitionedMesh,
    @NonNull OutputStream output
)
```

Write a gzip-compressed `ink.proto.CodedModeledShape` binary proto message representing the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` to the given `https://developer.android.com/reference/java/io/OutputStream.html`. Kotlin callers should use `https://developer.android.com/reference/androidx/ink/storage/package-summary#(androidx.ink.geometry.PartitionedMesh).encode(java.io.OutputStream)` instead.