package o; import com.bumptech.glide.load.ImageHeaderParser; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.util.List; /* loaded from: classes.dex */ public final class XRI implements iYP { private final List a; private final Opg c; private final iYP e; @Override // o.iYP public final /* synthetic */ Ezi a(InputStream inputStream, int i, int i2, unA una) throws IOException { byte[] a = a(inputStream); if (a == null) { return null; } return this.e.a(ByteBuffer.wrap(a), i, i2, una); } @Override // o.iYP public final /* synthetic */ boolean a(InputStream inputStream, unA una) throws IOException { InputStream inputStream2 = inputStream; wrW wrw = C17312vih.e; return !((Boolean) (una.d.containsKey(wrw) ? una.d.get(wrw) : wrw.a)).booleanValue() && hKF.a(this.a, inputStream2, this.c) == ImageHeaderParser.ImageType.GIF; } public XRI(List list, iYP iyp, Opg opg) { this.a = list; this.e = iyp; this.c = opg; } private static byte[] a(InputStream inputStream) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(16384); try { byte[] bArr = new byte[16384]; while (true) { int read = inputStream.read(bArr); if (read != -1) { byteArrayOutputStream.write(bArr, 0, read); } else { byteArrayOutputStream.flush(); return byteArrayOutputStream.toByteArray(); } } } catch (IOException unused) { return null; } } }