# ImmutableByteArray.Builder

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/ImmutableByteArray.java+class:androidx.media3.test.utils.ImmutableByteArray.Builder)

*** ** * ** ***


```
class ImmutableByteArray.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#Builder()()` Constructs a new instance with a default initial capacity. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#Builder(int)(initialCapacity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Constructs a new instance with the provided initial capacity. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#add(byte)(b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html)` Add the provided `byte` to the builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#addAll(byte[])(bytes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Add the contents of the provided array to this builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#addAll(java.util.Collection<java.lang.Byte>)(bytes: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-collection/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html!>!)` Add the contents of the provided collection to this builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#addAll(androidx.media3.test.utils.ImmutableByteArray)(bytes: https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray!)` Add the contents of the provided array to this builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#addAllUnsigned(long[])(bytes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>!)` Cast the elements of the provided `long[]` with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/UnsignedBytes.html#checkedCast(long)` and add them to the builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#addAllUnsigned(int[])(bytes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!)` Cast the elements of the provided `int[]` with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/UnsignedBytes.html#checkedCast(long)` and add them to the builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#addAllUnsigned(java.util.Collection<java.lang.Long>)(bytes: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-collection/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html!>!)` Cast the elements of the provided `https://developer.android.com/reference/java/util/Collection.html` with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/UnsignedBytes.html#checkedCast(long)` and add them to the builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#addUnsigned(long)(b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Cast the provided `long` with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/UnsignedBytes.html#checkedCast(long)` and add it to the builder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ImmutableByteArray.Builder#build()()` Returns the built array. |

## Public constructors

### Builder

```
Builder()
```

Constructs a new instance with a default initial capacity.

### Builder

```
Builder(initialCapacity: Int)
```

Constructs a new instance with the provided initial capacity.

## Public functions

### add

```
@CanIgnoreReturnValue
fun add(b: Byte): ImmutableByteArray.Builder!
```

Add the provided `byte` to the builder.

### addAll

```
@CanIgnoreReturnValue
fun addAll(bytes: ByteArray<Byte>!): ImmutableByteArray.Builder!
```

Add the contents of the provided array to this builder.

### addAll

```
@CanIgnoreReturnValue
fun addAll(bytes: (Mutable)Collection<Byte!>!): ImmutableByteArray.Builder!
```

Add the contents of the provided collection to this builder.

### addAll

```
@CanIgnoreReturnValue
fun addAll(bytes: ImmutableByteArray!): ImmutableByteArray.Builder!
```

Add the contents of the provided array to this builder.

### addAllUnsigned

```
@CanIgnoreReturnValue
fun addAllUnsigned(bytes: LongArray<Long>!): ImmutableByteArray.Builder!
```

Cast the elements of the provided `long[]` with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/UnsignedBytes.html#checkedCast(long)` and add them to the builder.

### addAllUnsigned

```
@CanIgnoreReturnValue
fun addAllUnsigned(bytes: IntArray<Int>!): ImmutableByteArray.Builder!
```

Cast the elements of the provided `int[]` with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/UnsignedBytes.html#checkedCast(long)` and add them to the builder.

### addAllUnsigned

```
@CanIgnoreReturnValue
fun addAllUnsigned(bytes: (Mutable)Collection<Long!>!): ImmutableByteArray.Builder!
```

Cast the elements of the provided `https://developer.android.com/reference/java/util/Collection.html` with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/UnsignedBytes.html#checkedCast(long)` and add them to the builder.

### addUnsigned

```
@CanIgnoreReturnValue
fun addUnsigned(b: Long): ImmutableByteArray.Builder!
```

Cast the provided `long` with `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/UnsignedBytes.html#checkedCast(long)` and add it to the builder.

### build

```
fun build(): ImmutableByteArray!
```

Returns the built array.