package s6; import android.util.Log; import e6.f; import e6.l; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.util.List; /* loaded from: classes2.dex */ public class j implements l { /* renamed from: a, reason: collision with root package name */ private final List f14058a; /* renamed from: b, reason: collision with root package name */ private final l f14059b; /* renamed from: c, reason: collision with root package name */ private final i6.a f14060c; public j(List list, l lVar, i6.a aVar) { this.f14058a = list; this.f14059b = lVar; this.f14060c = aVar; } private static byte[] c(InputStream inputStream) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(16384); try { byte[] bArr = new byte[16384]; while (true) { int read = inputStream.read(bArr); if (read == -1) { byteArrayOutputStream.flush(); return byteArrayOutputStream.toByteArray(); } byteArrayOutputStream.write(bArr, 0, read); } } catch (IOException e10) { if (!Log.isLoggable("StreamGifDecoder", 5)) { return null; } Log.w("StreamGifDecoder", "Error reading data from stream", e10); return null; } } @Override // e6.l /* renamed from: d, reason: merged with bridge method [inline-methods] */ public h6.h a(InputStream inputStream, int i10, int i11, e6.j jVar) { byte[] c10 = c(inputStream); if (c10 == null) { return null; } return this.f14059b.a(ByteBuffer.wrap(c10), i10, i11, jVar); } @Override // e6.l /* renamed from: e, reason: merged with bridge method [inline-methods] */ public boolean b(InputStream inputStream, e6.j jVar) { return !((Boolean) jVar.d(i.f14057b)).booleanValue() && e6.g.g(this.f14058a, inputStream, this.f14060c) == f.a.GIF; } }