# ByteBufferRegion

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

*** ** * ** ***


```
class ByteBufferRegion
```

<br />

*** ** * ** ***

A container holding a reference to a `https://developer.android.com/reference/java/nio/ByteBuffer.html`, along with an offset and size.

This is used to define a specific slice or region within a buffer.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `offset` or `size` is negative, or if `offset + size` exceeds `buffer.capacity()`. |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ByteBufferRegion#ByteBufferRegion(java.nio.ByteBuffer,kotlin.Int,kotlin.Int)( buffer: https://developer.android.com/reference/java/nio/ByteBuffer.html, offset: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, size: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ByteBufferRegion#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ByteBufferRegion#hashCode()()` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/java/nio/ByteBuffer.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ByteBufferRegion#buffer()` containing the data |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ByteBufferRegion#offset()` starting position within the buffer in bytes |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ByteBufferRegion#size()` number of bytes in the region |

## Public constructors

### ByteBufferRegion

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
ByteBufferRegion(
    buffer: ByteBuffer,
    offset: @IntRange(from = 0) Int,
    size: @IntRange(from = 0) Int
)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

## Public properties

### buffer

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val buffer: ByteBuffer
```

containing the data

### offset

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val offset: @IntRange(from = 0) Int
```

starting position within the buffer in bytes

### size

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val size: @IntRange(from = 0) Int
```

number of bytes in the region