java.lang.Object | ||
↳ | com.facebook.datasource.AbstractDataSource<T> | |
↳ | com.facebook.imagepipeline.datasource.SettableDataSource<T> |
A This data source has no intermediate results - calling #set(CloseableReferenceDataSource
whose result may be set by a #set(CloseableReferencesetException(Throwable)
call. It may also be closed.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static <V> SettableDataSource<V> |
create()
Creates a new
SettableDataSource | ||||||||||
CloseableReference<T> |
getResult()
Gets the result if any, null otherwise.
| ||||||||||
boolean |
set(CloseableReference<T> valueRef)
Sets the value of this data source.
| ||||||||||
boolean |
setException(Throwable throwable)
Sets the data source to having failed with the given exception.
| ||||||||||
boolean |
setProgress(float progress)
Sets the progress.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
closeResult(CloseableReference<T> result)
Subclasses should override this method to close the result that is not needed anymore.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.facebook.datasource.AbstractDataSource
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.facebook.datasource.DataSource
|
Gets the result if any, null otherwise.
Value will be cloned and it's the caller's responsibility to close the returned value.
Sets the value of this data source.
This method will return true
if the value was successfully set, or false
if
the data source has already been set, failed or closed.
Passed CloseableReference is cloned, caller of this method still owns passed reference after the method returns.
valueRef | closeable reference to the value the data source should hold. |
---|
Sets the data source to having failed with the given exception.
This method will return true
if the exception was successfully set, or false
if the data source has already been set, failed or closed.
throwable | the exception the data source should hold. |
---|
Sets the progress.
progress | the progress in range [0, 1] to be set. |
---|
Subclasses should override this method to close the result that is not needed anymore.
This method is called in two cases: 1. to clear the result when data source gets closed 2. to clear the previous result when a new result is set