FakeDataSet.FakeData


public final class FakeDataSet.FakeData


Container of fake data to be served by a FakeDataSource.

Summary

Nested types

public final class FakeDataSet.FakeData.Segment

A segment of FakeData.

Public fields

final @Nullable Uri

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

Public methods

FakeDataSet.FakeData

Appends an action.

FakeDataSet.FakeData

Appends to the underlying data.

FakeDataSet.FakeData

Appends a data segment of the specified length.

FakeDataSet.FakeData

Appends an error in the underlying data.

FakeDataSet

Returns the FakeDataSet this FakeData belongs to.

byte[]

Returns the whole data added by appendReadData.

List<FakeDataSet.FakeData.Segment>

Returns the list of Segments.

boolean

Returns whether unknown length is simulated

FakeDataSet.FakeData
@CanIgnoreReturnValue
setSimulateUnknownLength(boolean simulateUnknownLength)

When set, open will behave as though the source is unable to determine the length of the underlying data.

Public fields

uri

public final @Nullable Uri uri

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

Public methods

appendReadAction

@CanIgnoreReturnValue
public FakeDataSet.FakeData appendReadAction(Runnable action)

Appends an action.

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 the 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.

endData

public FakeDataSet endData()

Returns the FakeDataSet this FakeData belongs to.

getData

public byte[] getData()

Returns the whole data added by appendReadData.

getSegments

public List<FakeDataSet.FakeData.SegmentgetSegments()

Returns the list of Segments.

isSimulatingUnknownLength

public boolean isSimulatingUnknownLength()

Returns whether unknown length is simulated

setSimulateUnknownLength

@CanIgnoreReturnValue
public FakeDataSet.FakeData setSimulateUnknownLength(boolean simulateUnknownLength)

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