1 package com.bumptech.glide.load.model; 2 3 import com.bumptech.glide.load.data.DataFetcher; 4 5 import java.net.URL; 6 7 /** 8 * A wrapper class that translates {@link java.net.URL} objects into {@link com.bumptech.glide.load.model.GlideUrl} 9 * objects and then uses the wrapped {@link com.bumptech.glide.load.model.ModelLoader} for 10 * {@link com.bumptech.glide.load.model.GlideUrl}s to load the data. 11 * 12 * @param <T> The type of data that will be loaded from the {@link java.net.URL}s. 13 */ 14 public class UrlLoader<T> implements ModelLoader<URL, T> { 15 private final ModelLoader<GlideUrl, T> glideUrlLoader; 16 17 public UrlLoader(ModelLoader<GlideUrl, T> glideUrlLoader) { 18 this.glideUrlLoader = glideUrlLoader; 19 } 20 21 @Override 22 public DataFetcher<T> getResourceFetcher(URL model, int width, int height) { 23 return glideUrlLoader.getResourceFetcher(new GlideUrl(model), width, height); 24 } 25 } 26