-
- All Implemented Interfaces:
-
com.facebook.imagepipeline.producers.NetworkFetcher
public class HttpUrlConnectionNetworkFetcher extends BaseNetworkFetcher<HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState>
Network fetcher that uses the simplest Android stack.
Apps requiring more sophisticated networking should implement their own .
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classHttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState
-
Field Summary
Fields Modifier and Type Field Description public final static intHTTP_TEMPORARY_REDIRECTpublic final static intHTTP_PERMANENT_REDIRECTpublic final static intHTTP_DEFAULT_TIMEOUT
-
Constructor Summary
Constructors Constructor Description HttpUrlConnectionNetworkFetcher()HttpUrlConnectionNetworkFetcher(int httpConnectionTimeout)HttpUrlConnectionNetworkFetcher(String userAgent, int httpConnectionTimeout)HttpUrlConnectionNetworkFetcher(String userAgent, Map<String, String> requestHeaders, int httpConnectionTimeout)
-
Method Summary
Modifier and Type Method Description HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchStatecreateFetchState(Consumer<EncodedImage> consumer, ProducerContext context)Creates a new instance of the FetchState-derived object used to store state. voidfetch(HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState fetchState, NetworkFetcher.Callback callback)Initiates the network fetch and informs the producer when a response is received via theprovided callback. voidonFetchCompletion(HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState fetchState, int byteSize)Called after the fetch completes. Map<String, String>getExtraMap(HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState fetchState, int byteSize)Gets a map containing extra parameters to pass to the listeners. -
Methods inherited from class com.facebook.imagepipeline.producers.BaseNetworkFetcher
getExtraMap, onFetchCompletion, shouldPropagate -
Methods inherited from class com.facebook.imagepipeline.producers.NetworkFetcher
createFetchState, fetch, getExtraMap, onFetchCompletion, shouldPropagate -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
HttpUrlConnectionNetworkFetcher
HttpUrlConnectionNetworkFetcher()
-
HttpUrlConnectionNetworkFetcher
HttpUrlConnectionNetworkFetcher(int httpConnectionTimeout)
-
HttpUrlConnectionNetworkFetcher
HttpUrlConnectionNetworkFetcher(String userAgent, int httpConnectionTimeout)
-
-
Method Detail
-
createFetchState
HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState createFetchState(Consumer<EncodedImage> consumer, ProducerContext context)
Creates a new instance of the FetchState-derived object used to store state.
- Parameters:
consumer- the consumer
-
fetch
void fetch(HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState fetchState, NetworkFetcher.Callback callback)
Initiates the network fetch and informs the producer when a response is received via theprovided callback.
- Parameters:
fetchState- the fetch-specific statecallback- the callback used to inform the network fetch producer
-
onFetchCompletion
void onFetchCompletion(HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState fetchState, int byteSize)
Called after the fetch completes.
Implementing this method is optional and is useful for instrumentation purposes.
- Parameters:
fetchState- the fetch-specific statebyteSize- size of the data in bytes
-
getExtraMap
Map<String, String> getExtraMap(HttpUrlConnectionNetworkFetcher.HttpUrlConnectionNetworkFetchState fetchState, int byteSize)
Gets a map containing extra parameters to pass to the listeners.
Returning map is optional and is useful for instrumentation purposes.
This map won't be modified by the caller.
- Parameters:
fetchState- the fetch-specific statebyteSize- size of the data in bytes
-
-
-
-