# FakeSampleStream.FakeSampleStreamItem

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/FakeSampleStream.java+class:androidx.media3.test.utils.FakeSampleStream.FakeSampleStreamItem)

*** ** * ** ***

<br />

```
class FakeSampleStream.FakeSampleStreamItem
```

<br />

*** ** * ** ***

Item to customize a return value of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/SampleStream#readData(androidx.media3.exoplayer.FormatHolder,androidx.media3.decoder.DecoderInputBuffer,int)`.

## Summary

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem#END_OF_STREAM_ITEM()` Item that designates the end of stream has been reached. |

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem#format(androidx.media3.common.Format)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` Creates an item representing the provided format. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem#oneByteSample(long)(timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Creates an item representing a sample with the provided timestamp. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem#oneByteSample(long,int)(timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates an item representing a sample with the provided timestamp and flags. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeSampleStream.FakeSampleStreamItem#sample(long,int,byte[])(timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sampleData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Creates an item representing a sample with the provided timestamp, flags and data. |

## Constants

### END_OF_STREAM_ITEM

```
const val END_OF_STREAM_ITEM: FakeSampleStream.FakeSampleStreamItem!
```

Item that designates the end of stream has been reached.

## Public functions

### format

```
java-static fun format(format: Format!): FakeSampleStream.FakeSampleStreamItem!
```

Creates an item representing the provided format.

### oneByteSample

```
java-static fun oneByteSample(timeUs: Long): FakeSampleStream.FakeSampleStreamItem!
```

Creates an item representing a sample with the provided timestamp.

The sample will contain a single byte of data.

| Parameters |
|---|---|
| `timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The timestamp of the sample. |

### oneByteSample

```
java-static fun oneByteSample(timeUs: Long, @C.BufferFlags flags: Int): FakeSampleStream.FakeSampleStreamItem!
```

Creates an item representing a sample with the provided timestamp and flags.

The sample will contain a single byte of data.

| Parameters |
|---|---|
| `timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The timestamp of the sample. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The sample `https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags`. |

### sample

```
java-static fun sample(timeUs: Long, @C.BufferFlags flags: Int, sampleData: ByteArray<Byte>!): FakeSampleStream.FakeSampleStreamItem!
```

Creates an item representing a sample with the provided timestamp, flags and data.

| Parameters |
|---|---|
| `timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The timestamp of the sample. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The sample `https://developer.android.com/reference/kotlin/androidx/media3/common/C.BufferFlags`. |
| `sampleData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The sample data. |