com.facebook.datasource.DataSource<T> |
Known Indirect Subclasses |
An alternative to Java Futures for the image pipeline.
Unlike Futures, DataSource can issue a series of results, rather than just one. A prime example is decoding progressive images, which have a series of intermediate results before the final one.
DataSources MUST be closed (close() is called on the DataSource) else resources may leak.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract boolean |
close()
Cancels the ongoing request and releases all associated resources.
| ||||||||||
abstract Map<String, Object> | getExtras() | ||||||||||
abstract Throwable | getFailureCause() | ||||||||||
abstract float | getProgress() | ||||||||||
abstract T |
getResult()
The most recent result of the asynchronous computation.
| ||||||||||
abstract boolean | hasFailed() | ||||||||||
abstract boolean | hasMultipleResults() | ||||||||||
abstract boolean | hasResult() | ||||||||||
abstract boolean | isClosed() | ||||||||||
abstract boolean | isFinished() | ||||||||||
abstract void |
subscribe(DataSubscriber<T> dataSubscriber, Executor executor)
Subscribe for notifications whenever the state of the DataSource changes.
|
Cancels the ongoing request and releases all associated resources.
Subsequent calls to getResult()
will return null.
The most recent result of the asynchronous computation.
The caller gains ownership of the object and is responsible for releasing it. Note that subsequent calls to getResult might give different results. Later results should be considered to be of higher quality.
This method will return null in the following cases:
hasResult
returns false).
Subscribe for notifications whenever the state of the DataSource changes.
All changes will be observed on the provided executor.