# Allocation

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

*** ** * ** ***

<br />

```
@UnstableApi
class Allocation
```

<br />

*** ** * ** ***

An allocation within a byte array.

The allocation's length is obtained by calling `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocator#getIndividualAllocationLength()` on the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocator` from which it was obtained.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocation#Allocation(byte[],int)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocation#data()` The array containing the allocated space. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocation#offset()` The offset of the allocated space in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocation#data()`. |

## Public constructors

### Allocation

```
Allocation(data: ByteArray<Byte>!, offset: Int)
```

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The array containing the allocated space. |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the allocated space in `data`. |

## Public properties

### data

```
val data: Array<Byte>!
```

The array containing the allocated space. The allocated space might not be at the start of the array, and so `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocation#offset()` must be used when indexing into it.

### offset

```
val offset: Int
```

The offset of the allocated space in `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/Allocation#data()`.