All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bumptech.glide.load.data.FileDescriptorLocalUriFetcher Maven / Gradle / Ivy

Go to download

A fast and efficient image loading library for Android focused on smooth scrolling.

There is a newer version: 5.0.0-rc01
Show newest version
package com.bumptech.glide.load.data;

import android.content.ContentResolver;
import android.content.Context;
import android.net.Uri;
import android.os.ParcelFileDescriptor;

import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * Fetches an {@link android.os.ParcelFileDescriptor} for a local {@link android.net.Uri}.
 */
public class FileDescriptorLocalUriFetcher extends LocalUriFetcher {
    public FileDescriptorLocalUriFetcher(Context context, Uri uri) {
        super(context, uri);
    }

    @Override
    protected ParcelFileDescriptor loadResource(Uri uri, ContentResolver contentResolver) throws FileNotFoundException {
        return contentResolver.openAssetFileDescriptor(uri, "r").getParcelFileDescriptor();
    }

    @Override
    protected void close(ParcelFileDescriptor data) throws IOException {
        data.close();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy