# ByteBufferAllocator

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

*** ** * ** ***


```
@UnstableApi
public interface ByteBufferAllocator
```

<br />

*** ** * ** ***

A memory allocator for `https://developer.android.com/reference/java/nio/ByteBuffer.html`.

## Summary

| ### Constants |
|---|---|
| `default static final https://developer.android.com/reference/androidx/media3/muxer/ByteBufferAllocator` | `https://developer.android.com/reference/androidx/media3/muxer/ByteBufferAllocator#DEFAULT()` Default implementation. |

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/java/nio/ByteBuffer.html` | `https://developer.android.com/reference/androidx/media3/muxer/ByteBufferAllocator#allocate(int)(int capacity)` Allocates and returns a new `https://developer.android.com/reference/java/nio/ByteBuffer.html`. |

## Constants

### DEFAULT

```
default static final ByteBufferAllocator DEFAULT
```

Default implementation.

## Public methods

### allocate

```
abstract ByteBuffer allocate(int capacity)
```

Allocates and returns a new `https://developer.android.com/reference/java/nio/ByteBuffer.html`.

| Parameters |
|---|---|
| `int capacity` | The new buffer's capacity, in bytes. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the `capacity` is a negative integer. |