Home | History | Annotate | Download | only in stream
      1 package com.bumptech.glide.load.model.stream;
      2 
      3 import android.content.Context;
      4 import android.net.Uri;
      5 
      6 import com.bumptech.glide.Glide;
      7 import com.bumptech.glide.load.model.FileLoader;
      8 import com.bumptech.glide.load.model.GenericLoaderFactory;
      9 import com.bumptech.glide.load.model.ModelLoader;
     10 import com.bumptech.glide.load.model.ModelLoaderFactory;
     11 
     12 import java.io.File;
     13 import java.io.InputStream;
     14 
     15 /**
     16  * A {@link ModelLoader} For translating {@link File} models for local uris into {@link InputStream} data.
     17  */
     18 public class StreamFileLoader extends FileLoader<InputStream> implements StreamModelLoader<File> {
     19 
     20     /**
     21      * The default factory for {@link com.bumptech.glide.load.model.stream.StreamFileLoader}s.
     22      */
     23     public static class Factory implements ModelLoaderFactory<File, InputStream> {
     24         @Override
     25         public ModelLoader<File, InputStream> build(Context context, GenericLoaderFactory factories) {
     26             return new StreamFileLoader(factories.buildModelLoader(Uri.class, InputStream.class));
     27         }
     28 
     29         @Override
     30         public void teardown() {
     31             // Do nothing.
     32         }
     33     }
     34 
     35     public StreamFileLoader(Context context) {
     36         this(Glide.buildStreamModelLoader(Uri.class, context));
     37     }
     38 
     39     public StreamFileLoader(ModelLoader<Uri, InputStream> uriLoader) {
     40         super(uriLoader);
     41     }
     42 
     43 }
     44