59 lines
1.7 KiB
Java
59 lines
1.7 KiB
Java
package com.bumptech.glide.load.data;
|
|
|
|
import android.content.res.AssetManager;
|
|
import android.util.Log;
|
|
import com.bumptech.glide.Priority;
|
|
import com.bumptech.glide.load.DataSource;
|
|
import com.bumptech.glide.load.data.DataFetcher;
|
|
import java.io.IOException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class AssetPathFetcher<T> implements DataFetcher<T> {
|
|
private final String a;
|
|
private final AssetManager b;
|
|
private T c;
|
|
|
|
public AssetPathFetcher(AssetManager assetManager, String str) {
|
|
this.b = assetManager;
|
|
this.a = str;
|
|
}
|
|
|
|
protected abstract T a(AssetManager assetManager, String str) throws IOException;
|
|
|
|
@Override // com.bumptech.glide.load.data.DataFetcher
|
|
public void a(Priority priority, DataFetcher.DataCallback<? super T> dataCallback) {
|
|
try {
|
|
this.c = a(this.b, this.a);
|
|
dataCallback.a((DataFetcher.DataCallback<? super T>) this.c);
|
|
} catch (IOException e) {
|
|
if (Log.isLoggable("AssetPathFetcher", 3)) {
|
|
Log.d("AssetPathFetcher", "Failed to load data from asset manager", e);
|
|
}
|
|
dataCallback.a((Exception) e);
|
|
}
|
|
}
|
|
|
|
protected abstract void a(T t) throws IOException;
|
|
|
|
@Override // com.bumptech.glide.load.data.DataFetcher
|
|
public void b() {
|
|
T t = this.c;
|
|
if (t == null) {
|
|
return;
|
|
}
|
|
try {
|
|
a(t);
|
|
} catch (IOException unused) {
|
|
}
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.data.DataFetcher
|
|
public void cancel() {
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.data.DataFetcher
|
|
public DataSource getDataSource() {
|
|
return DataSource.LOCAL;
|
|
}
|
|
}
|