Class FakeDataSet.FakeData
- java.lang.Object
-
- com.google.android.exoplayer2.testutil.FakeDataSet.FakeData
-
- Enclosing class:
- FakeDataSet
public static final class FakeDataSet.FakeData extends Object
Container of fake data to be served by aFakeDataSource
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FakeDataSet.FakeData.Segment
A segment ofFakeDataSet.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 theFakeDataSet
this FakeData belongs to.byte[]
getData()
Returns the whole data added byappendReadData(byte[])
.List<FakeDataSet.FakeData.Segment>
getSegments()
Returns the list ofFakeDataSet.FakeData.Segment
s.boolean
isSimulatingUnknownLength()
Returns whether unknown length is simulatedFakeDataSet.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.
-
-
-
Field Detail
-
uri
@Nullable public final Uri uri
Uri of the data or null if this is the default FakeData.
-
-
Method Detail
-
endData
public FakeDataSet endData()
Returns theFakeDataSet
this FakeData belongs to.
-
setSimulateUnknownLength
@CanIgnoreReturnValue public 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. Hence the return value will always be equal to theDataSpec.length
of the argument, including the case where the length is equal toC.LENGTH_UNSET
.
-
appendReadData
@CanIgnoreReturnValue public FakeDataSet.FakeData appendReadData(byte[] data)
Appends to the underlying data.
-
appendReadData
@CanIgnoreReturnValue public FakeDataSet.FakeData appendReadData(int length)
Appends a data segment of the specified length. No actual data is available and theFakeDataSource
will perform no copy operations when this data is read.
-
appendReadError
@CanIgnoreReturnValue public FakeDataSet.FakeData appendReadError(IOException exception)
Appends an error in the underlying data.
-
appendReadAction
@CanIgnoreReturnValue public FakeDataSet.FakeData appendReadAction(Runnable action)
Appends an action.
-
getData
public byte[] getData()
Returns the whole data added byappendReadData(byte[])
.
-
getSegments
public List<FakeDataSet.FakeData.Segment> getSegments()
Returns the list ofFakeDataSet.FakeData.Segment
s.
-
isSimulatingUnknownLength
public boolean isSimulatingUnknownLength()
Returns whether unknown length is simulated
-
-