com.bumptech.glide.load.model
Class UriLoader<T>

java.lang.Object
  extended by com.bumptech.glide.load.model.UriLoader<T>
Type Parameters:
T - The type of data that will be retrieved for Uris.
All Implemented Interfaces:
ModelLoader<Uri,T>
Direct Known Subclasses:
FileDescriptorUriLoader, StreamUriLoader

public abstract class UriLoader<T>
extends Object
implements ModelLoader<Uri,T>

A base ModelLoader for Uris that handles local Uris directly and routes remote Uris to a wrapped ModelLoader that handles GlideUrls.


Constructor Summary
UriLoader(Context context, ModelLoader<GlideUrl,T> urlLoader)
           
 
Method Summary
protected abstract  DataFetcher<T> getAssetPathFetcher(Context context, String path)
           
protected abstract  DataFetcher<T> getLocalUriFetcher(Context context, Uri uri)
           
 DataFetcher<T> getResourceFetcher(Uri model, int width, int height)
          Obtains an DataFetcher that can fetch the data required to decode the resource represented by this model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UriLoader

public UriLoader(Context context,
                 ModelLoader<GlideUrl,T> urlLoader)
Method Detail

getResourceFetcher

public final DataFetcher<T> getResourceFetcher(Uri model,
                                               int width,
                                               int height)
Description copied from interface: ModelLoader
Obtains an DataFetcher that can fetch the data required to decode the resource represented by this model. The DataFetcher will not be used if the resource is already cached.

Note - If no valid data fetcher can be returned (for example if a model has a null URL), then it is acceptable to return a null data fetcher from this method. Doing so will be treated any other failure or exception during the load process.

Specified by:
getResourceFetcher in interface ModelLoader<Uri,T>
Parameters:
model - The model representing the resource.
width - The width in pixels of the view or target the resource will be loaded into, or Target.SIZE_ORIGINAL to indicate that the resource should be loaded at its original width.
height - The height in pixels of the view or target the resource will be loaded into, or Target.SIZE_ORIGINAL to indicate that the resource should be loaded at its original height.
Returns:
A DataFetcher that can obtain the data the resource can be decoded from if the resource is not cached, or null if no valid DataFetcher could be constructed.

getLocalUriFetcher

protected abstract DataFetcher<T> getLocalUriFetcher(Context context,
                                                     Uri uri)

getAssetPathFetcher

protected abstract DataFetcher<T> getAssetPathFetcher(Context context,
                                                      String path)