Home | History | Annotate | Download | only in stream
      1 package com.bumptech.glide.load.model.stream;
      2 
      3 import android.content.Context;
      4 
      5 import com.bumptech.glide.load.model.GenericLoaderFactory;
      6 import com.bumptech.glide.load.model.GlideUrl;
      7 import com.bumptech.glide.load.model.ModelLoader;
      8 import com.bumptech.glide.load.model.ModelLoaderFactory;
      9 import com.bumptech.glide.load.model.UrlLoader;
     10 
     11 import java.io.InputStream;
     12 import java.net.URL;
     13 
     14 /**
     15  * A wrapper class that translates {@link java.net.URL} objects into {@link com.bumptech.glide.load.model.GlideUrl}
     16  * objects and then uses the wrapped {@link com.bumptech.glide.load.model.ModelLoader} for
     17  * {@link com.bumptech.glide.load.model.GlideUrl}s to load the {@link java.io.InputStream} data.
     18  */
     19 public class StreamUrlLoader extends UrlLoader<InputStream> {
     20 
     21     /**
     22      * The default factory for {@link com.bumptech.glide.load.model.stream.StreamUrlLoader}s.
     23      */
     24     public static class Factory implements ModelLoaderFactory<URL, InputStream> {
     25         @Override
     26         public ModelLoader<URL, InputStream> build(Context context, GenericLoaderFactory factories) {
     27             return new StreamUrlLoader(factories.buildModelLoader(GlideUrl.class, InputStream.class));
     28         }
     29 
     30         @Override
     31         public void teardown() {
     32             // Do nothing.
     33         }
     34     }
     35 
     36     public StreamUrlLoader(ModelLoader<GlideUrl, InputStream> glideUrlLoader) {
     37         super(glideUrlLoader);
     38     }
     39 }
     40