1 package com.bumptech.glide.load.data; 2 3 import android.content.ContentResolver; 4 import android.content.Context; 5 import android.net.Uri; 6 7 import java.io.FileNotFoundException; 8 import java.io.IOException; 9 import java.io.InputStream; 10 11 /** 12 * Fetches an {@link java.io.InputStream} for a local {@link android.net.Uri}. 13 */ 14 public class StreamLocalUriFetcher extends LocalUriFetcher<InputStream> { 15 public StreamLocalUriFetcher(Context context, Uri uri) { 16 super(context, uri); 17 } 18 19 @Override 20 protected InputStream loadResource(Uri uri, ContentResolver contentResolver) throws FileNotFoundException { 21 return contentResolver.openInputStream(uri); 22 } 23 24 @Override 25 protected void close(InputStream data) throws IOException { 26 data.close(); 27 } 28 } 29