# FakeDataSet.FakeData

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

*** ** * ** ***


```
class FakeDataSet.FakeData
```

<br />

*** ** * ** ***

Container of fake data to be served by a `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSource`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData.Segment` A segment of `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#appendReadAction(java.lang.Runnable)(action: https://developer.android.com/reference/java/lang/Runnable.html!)` Appends an action. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#appendReadData(byte[])(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!)` Appends to the underlying data. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#appendReadData(int)(length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Appends a data segment of the specified length. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#appendReadError(java.io.IOException)(exception: https://developer.android.com/reference/java/io/IOException.html!)` Appends an error in the underlying data. |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#endData()()` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet` this FakeData belongs to. |
| `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/test/utils/FakeDataSet.FakeData#getData()()` Returns the whole data added by `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#appendReadData(byte[])`. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData.Segment!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#getSegments()()` Returns the list of `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData.Segment`s. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#isSimulatingUnknownLength()()` Returns whether unknown length is simulated |
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#setSimulateUnknownLength(boolean)(simulateUnknownLength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` When set, `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSource#open(androidx.media3.datasource.DataSpec)` will behave as though the source is unable to determine the length of the underlying data. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/android/net/Uri.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#uri()` Uri of the data or null if this is the default FakeData. |

## Public functions

### appendReadAction

```
@CanIgnoreReturnValue
fun appendReadAction(action: Runnable!): FakeDataSet.FakeData!
```

Appends an action.

### appendReadData

```
@CanIgnoreReturnValue
fun appendReadData(data: ByteArray<Byte>!): FakeDataSet.FakeData!
```

Appends to the underlying data.

### appendReadData

```
@CanIgnoreReturnValue
fun appendReadData(length: Int): FakeDataSet.FakeData!
```

Appends a data segment of the specified length. No actual data is available and the `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSource` will perform no copy operations when this data is read.

### appendReadError

```
@CanIgnoreReturnValue
fun appendReadError(exception: IOException!): FakeDataSet.FakeData!
```

Appends an error in the underlying data.

### endData

```
fun endData(): FakeDataSet!
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet` this FakeData belongs to.

### getData

```
fun getData(): Array<Byte>!
```

Returns the whole data added by `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData#appendReadData(byte[])`.

### getSegments

```
fun getSegments(): (Mutable)List<FakeDataSet.FakeData.Segment!>!
```

Returns the list of `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSet.FakeData.Segment`s.

### isSimulatingUnknownLength

```
fun isSimulatingUnknownLength(): Boolean
```

Returns whether unknown length is simulated

### setSimulateUnknownLength

```
@CanIgnoreReturnValue
fun setSimulateUnknownLength(simulateUnknownLength: Boolean): FakeDataSet.FakeData!
```

When set, `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FakeDataSource#open(androidx.media3.datasource.DataSpec)` will behave as though the source is unable to determine the length of the underlying data. Hence the return value will always be equal to the `https://developer.android.com/reference/kotlin/androidx/media3/datasource/DataSpec#length()` of the argument, including the case where the length is equal to `https://developer.android.com/reference/kotlin/androidx/media3/common/C#LENGTH_UNSET()`.

## Public properties

### uri

```
val uri: Uri?
```

Uri of the data or null if this is the default FakeData.