public class

NetworkFetchProducer

extends Object
implements Producer<T>
java.lang.Object
   ↳ com.facebook.imagepipeline.producers.NetworkFetchProducer

Class Overview

A producer to actually fetch images from the network.

Downloaded bytes may be passed to the consumer as they are downloaded, but not more often than #TIME_BETWEEN_PARTIAL_RESULTS_MS.

Clients should provide an instance of NetworkFetcher to make use of their networking stack. Use HttpUrlConnectionNetworkFetcher as a model.

Summary

Constants
String INTERMEDIATE_RESULT_PRODUCER_EVENT
String PRODUCER_NAME
Fields
protected final PooledByteBufferFactory mPooledByteBufferFactory
Public Constructors
NetworkFetchProducer(PooledByteBufferFactory pooledByteBufferFactory, ByteArrayPool byteArrayPool, NetworkFetcher networkFetcher)
Public Methods
void produceResults(Consumer<EncodedImage> consumer, ProducerContext context)
Protected Methods
static float calculateProgress(int downloaded, int total)
long getSystemUptime()
void handleFinalResult(PooledByteBufferOutputStream pooledOutputStream, FetchState fetchState)
void maybeHandleIntermediateResult(PooledByteBufferOutputStream pooledOutputStream, FetchState fetchState)
static void notifyConsumer(PooledByteBufferOutputStream pooledOutputStream, int status, BytesRange responseBytesRange, Consumer<EncodedImage> consumer, ProducerContext context)
void onResponse(FetchState fetchState, InputStream responseData, int responseContentLength)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.facebook.imagepipeline.producers.Producer

Constants

public static final String INTERMEDIATE_RESULT_PRODUCER_EVENT

Constant Value: "intermediate_result"

public static final String PRODUCER_NAME

Constant Value: "NetworkFetchProducer"

Fields

protected final PooledByteBufferFactory mPooledByteBufferFactory

Public Constructors

public NetworkFetchProducer (PooledByteBufferFactory pooledByteBufferFactory, ByteArrayPool byteArrayPool, NetworkFetcher networkFetcher)

Public Methods

public void produceResults (Consumer<EncodedImage> consumer, ProducerContext context)

Protected Methods

protected static float calculateProgress (int downloaded, int total)

protected long getSystemUptime ()

protected void handleFinalResult (PooledByteBufferOutputStream pooledOutputStream, FetchState fetchState)

protected void maybeHandleIntermediateResult (PooledByteBufferOutputStream pooledOutputStream, FetchState fetchState)

protected static void notifyConsumer (PooledByteBufferOutputStream pooledOutputStream, int status, BytesRange responseBytesRange, Consumer<EncodedImage> consumer, ProducerContext context)

protected void onResponse (FetchState fetchState, InputStream responseData, int responseContentLength)

Throws
IOException