Class BaseGlideUrlLoader<Model>
- java.lang.Object
-
- com.bumptech.glide.load.model.stream.BaseGlideUrlLoader<Model>
-
- Type Parameters:
Model- The type of the model.
- All Implemented Interfaces:
ModelLoader<Model,java.io.InputStream>
public abstract class BaseGlideUrlLoader<Model> extends java.lang.Object implements ModelLoader<Model,java.io.InputStream>
A base class for loading data over http/https. Can be subclassed for use with any model that can be translated in toInputStreamdata.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.bumptech.glide.load.model.ModelLoader
ModelLoader.LoadData<Data>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseGlideUrlLoader(ModelLoader<GlideUrl,java.io.InputStream> concreteLoader)protectedBaseGlideUrlLoader(ModelLoader<GlideUrl,java.io.InputStream> concreteLoader, ModelCache<Model,GlideUrl> modelCache)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ModelLoader.LoadData<java.io.InputStream>buildLoadData(Model model, int width, int height, Options options)Returns aModelLoader.LoadDatacontaining aDataFetcherrequired to decode the resource represented by this model, as well as a set ofKeysthat identify the data loaded by theDataFetcheras well as an optional list of alternate keys from which equivalent data can be loaded.protected java.util.List<java.lang.String>getAlternateUrls(Model model, int width, int height, Options options)Returns a list of alternate urls for the given model, width, and height from which equivalent data can be obtained (usually the same image with the same aspect ratio, but in a larger size) as the primary url.protected HeadersgetHeaders(Model model, int width, int height, Options options)Returns the headers for the given model and dimensions as a map of strings to sets of strings, or null if no headers should be added.protected abstract java.lang.StringgetUrl(Model model, int width, int height, Options options)Returns a valid url http:// or https:// for the given model and dimensions as a string.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.bumptech.glide.load.model.ModelLoader
handles
-
-
-
-
Constructor Detail
-
BaseGlideUrlLoader
protected BaseGlideUrlLoader(ModelLoader<GlideUrl,java.io.InputStream> concreteLoader)
-
BaseGlideUrlLoader
protected BaseGlideUrlLoader(ModelLoader<GlideUrl,java.io.InputStream> concreteLoader, @Nullable ModelCache<Model,GlideUrl> modelCache)
-
-
Method Detail
-
buildLoadData
@Nullable public ModelLoader.LoadData<java.io.InputStream> buildLoadData(@NonNull Model model, int width, int height, @NonNull Options options)
Description copied from interface:ModelLoaderReturns aModelLoader.LoadDatacontaining aDataFetcherrequired to decode the resource represented by this model, as well as a set ofKeysthat identify the data loaded by theDataFetcheras well as an optional list of alternate keys from which equivalent data can be loaded. TheDataFetcherwill 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.
- Specified by:
buildLoadDatain interfaceModelLoader<Model,java.io.InputStream>- Parameters:
model- The model representing the resource.width- The width in pixels of the view or target the resource will be loaded into, orTarget.SIZE_ORIGINALto 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, orTarget.SIZE_ORIGINALto indicate that the resource should be loaded at its original height.
-
getUrl
protected abstract java.lang.String getUrl(Model model, int width, int height, Options options)
Returns a valid url http:// or https:// for the given model and dimensions as a string.- Parameters:
model- The model.width- The width in pixels of the view/target the image will be loaded into.height- The height in pixels of the view/target the image will be loaded into.
-
getAlternateUrls
protected java.util.List<java.lang.String> getAlternateUrls(Model model, int width, int height, Options options)
Returns a list of alternate urls for the given model, width, and height from which equivalent data can be obtained (usually the same image with the same aspect ratio, but in a larger size) as the primary url.Implementing this method allows Glide to fulfill requests for bucketed images in smaller bucket sizes using already cached data for larger bucket sizes.
- Parameters:
width- The width in pixels of the view/target the image will be loaded into.height- The height in pixels of the view/target the image will be loaded into.
-
getHeaders
@Nullable protected Headers getHeaders(Model model, int width, int height, Options options)
Returns the headers for the given model and dimensions as a map of strings to sets of strings, or null if no headers should be added.- Parameters:
model- The model.width- The width in pixels of the view/target the image will be loaded into.height- The height in pixels of the view/target the image will be loaded into.
-
-