1 package com.bumptech.glide.load.data; 2 3 import android.content.res.AssetManager; 4 import android.os.ParcelFileDescriptor; 5 6 import java.io.IOException; 7 8 /** 9 * Fetches an {@link android.os.ParcelFileDescriptor} for an asset path. 10 */ 11 public class FileDescriptorAssetPathFetcher extends AssetPathFetcher<ParcelFileDescriptor> { 12 public FileDescriptorAssetPathFetcher(AssetManager assetManager, String assetPath) { 13 super(assetManager, assetPath); 14 } 15 16 @Override 17 protected ParcelFileDescriptor loadResource(AssetManager assetManager, String path) throws IOException { 18 return assetManager.openFd(path).getParcelFileDescriptor(); 19 } 20 21 @Override 22 protected void close(ParcelFileDescriptor data) throws IOException { 23 data.close(); 24 } 25 } 26