Back to Exoplayer

FakeDataSet.FakeData (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/testutil/FakeDataSet.FakeData.html

latest5.9 KB
Original Source

Package com.google.android.exoplayer2.testutil

Class FakeDataSet.FakeData


public static final classFakeDataSet.FakeDataextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

Container of fake data to be served by a FakeDataSource.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static class | FakeDataSet.FakeData.Segment | A segment of FakeDataSet.FakeData. |

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | Uri | uri | Uri of the data or null if this is the default FakeData. |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | FakeDataSet.FakeData | appendReadAction​(Runnable action) | Appends an action. | | FakeDataSet.FakeData | appendReadData​(byte[] data) | Appends to the underlying data. | | FakeDataSet.FakeData | appendReadData​(int length) | Appends a data segment of the specified length. | | FakeDataSet.FakeData | appendReadError​(IOException exception) | Appends an error in the underlying data. | | FakeDataSet | endData() | Returns the FakeDataSet this FakeData belongs to. | | byte[] | getData() | Returns the whole data added by appendReadData(byte[]). | | List<FakeDataSet.FakeData.Segment> | getSegments() | Returns the list of FakeDataSet.FakeData.Segments. | | boolean | isSimulatingUnknownLength() | Returns whether unknown length is simulated | | FakeDataSet.FakeData | setSimulateUnknownLength​(boolean simulateUnknownLength) | When set, FakeDataSource.open(DataSpec) will behave as though the source is unable to determine the length of the underlying data. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

uri

@Nullable
public final[Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri

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

Method Detail

- 

endData

public[FakeDataSet](FakeDataSet.html "class in com.google.android.exoplayer2.testutil")endData()

Returns the FakeDataSet this FakeData belongs to.

- 

setSimulateUnknownLength

@CanIgnoreReturnValue
public[FakeDataSet.FakeData](FakeDataSet.FakeData.html "class in com.google.android.exoplayer2.testutil")setSimulateUnknownLength​(boolean simulateUnknownLength)

When set, FakeDataSource.open(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 DataSpec.length of the argument, including the case where the length is equal to C.LENGTH_UNSET.

- 

appendReadData

@CanIgnoreReturnValue
public[FakeDataSet.FakeData](FakeDataSet.FakeData.html "class in com.google.android.exoplayer2.testutil")appendReadData​(byte[] data)

Appends to the underlying data.

- 

appendReadData

@CanIgnoreReturnValue
public[FakeDataSet.FakeData](FakeDataSet.FakeData.html "class in com.google.android.exoplayer2.testutil")appendReadData​(int length)

Appends a data segment of the specified length. No actual data is available and the FakeDataSource will perform no copy operations when this data is read.

- 

appendReadError

@CanIgnoreReturnValue
public[FakeDataSet.FakeData](FakeDataSet.FakeData.html "class in com.google.android.exoplayer2.testutil")appendReadError​([IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")exception)

Appends an error in the underlying data.

- 

appendReadAction

@CanIgnoreReturnValue
public[FakeDataSet.FakeData](FakeDataSet.FakeData.html "class in com.google.android.exoplayer2.testutil")appendReadAction​([Runnable](https://developer.android.com/reference/java/lang/Runnable.html "class or interface in java.lang")action)

Appends an action.

- 

getData

public byte[] getData()

Returns the whole data added by appendReadData(byte[]).

- 

getSegments

public[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[FakeDataSet.FakeData.Segment](FakeDataSet.FakeData.Segment.html "class in com.google.android.exoplayer2.testutil")> getSegments()

Returns the list of FakeDataSet.FakeData.Segments.

- 

isSimulatingUnknownLength

public boolean isSimulatingUnknownLength()

Returns whether unknown length is simulated