Back to Fresco

BaseDataSubscriber

docs/javadoc/reference/com/facebook/datasource/BaseDataSubscriber.html

3.6.016.6 KB
Original Source

Fresco

|

|

Packages | Classes

Interfaces

Classes

Packages | Classes

Summary: Ctors | Methods | Protected Methods | Inherited Methods | [Expand All]

public abstract class

BaseDataSubscriber

extends Object
implements DataSubscriber<T>

| java.lang.Object | | ↳ | com.facebook.datasource.BaseDataSubscriber<T> |

| Known Direct Subclasses

BaseBitmapDataSubscriber, BaseBitmapReferenceDataSubscriber, BaseListBitmapDataSubscriber

| BaseBitmapDataSubscriber | Implementation of DataSubscriber for cases where the client wants access to a bitmap. | | BaseBitmapReferenceDataSubscriber | Implementation of DataSubscriber for cases where the client wants access to a bitmap reference. | | BaseListBitmapDataSubscriber | Implementation of DataSubscriber for cases where the client wants to access a list of bitmaps. |

|

Class Overview

Base implementation of DataSubscriber that ensures that the data source is closed when the subscriber has finished with it.

Sample usage:

dataSource.subscribe(
   new BaseDataSubscriber() {
     @Override
     public void onNewResultImpl(DataSource dataSource) {
       // Store image ref to be released later.
       mCloseableImageRef = dataSource.getResult();
       // Use the image.
       updateImage(mCloseableImageRef);
       // No need to do any cleanup of the data source.
     }

     @Override
     public void onFailureImpl(DataSource dataSource) {
       // No cleanup of the data source required here.
     }
   });

Summary

Public Constructors
Public Methods
void
Called whenever the request is cancelled (a request being cancelled means that is was closed before it finished).
void
Called whenever an error occurs inside of the pipeline.
void
Called whenever a new value is ready to be retrieved from the DataSource.
void
Called when the progress updates.
Protected Methods
abstract void
abstract void

| [Expand] Inherited Methods | | --- | | From class java.lang.Object

| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

| | From interface com.facebook.datasource.DataSubscriber

| abstract void | onCancellation(DataSource<T> dataSource) Called whenever the request is cancelled (a request being cancelled means that is was closed before it finished). | | abstract void | onFailure(DataSource<T> dataSource) Called whenever an error occurs inside of the pipeline. | | abstract void | onNewResult(DataSource<T> dataSource) Called whenever a new value is ready to be retrieved from the DataSource. | | abstract void | onProgressUpdate(DataSource<T> dataSource) Called when the progress updates. |

|

Public Constructors

public BaseDataSubscriber()

Public Methods

public void onCancellation(DataSource<T> dataSource)

Called whenever the request is cancelled (a request being cancelled means that is was closed before it finished).

No further results will be produced after this method is called.

public void onFailure(DataSource<T> dataSource)

Called whenever an error occurs inside of the pipeline.

No further results will be produced after this method is called.

The throwable resulting from the failure can be obtained using dataSource.getFailureCause.

public void onNewResult(DataSource<T> dataSource)

Called whenever a new value is ready to be retrieved from the DataSource.

To retrieve the new value, call dataSource.getResult().

To determine if the new value is the last, use dataSource.isFinished().

public void onProgressUpdate(DataSource<T> dataSource)

Called when the progress updates.

Protected Methods

protected abstract void onFailureImpl(DataSource<T> dataSource)

protected abstract void onNewResultImpl(DataSource<T> dataSource)

+Generated by Doclava. +