package q3; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Enumeration; /* loaded from: classes2.dex */ public final class g extends InputStream { /* renamed from: a, reason: collision with root package name */ private final Enumeration f13458a; /* renamed from: b, reason: collision with root package name */ private InputStream f13459b; public g(Enumeration enumeration) { this.f13458a = enumeration; c(); } final void c() { InputStream inputStream = this.f13459b; if (inputStream != null) { inputStream.close(); } if (this.f13458a.hasMoreElements()) { this.f13459b = new FileInputStream((File) this.f13458a.nextElement()); } else { this.f13459b = null; } } @Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable public final void close() { super.close(); InputStream inputStream = this.f13459b; if (inputStream != null) { inputStream.close(); this.f13459b = null; } } @Override // java.io.InputStream public final int read() { while (true) { InputStream inputStream = this.f13459b; if (inputStream == null) { return -1; } int read = inputStream.read(); if (read != -1) { return read; } c(); } } @Override // java.io.InputStream public final int read(byte[] bArr, int i10, int i11) { if (this.f13459b == null) { return -1; } bArr.getClass(); if (i10 < 0 || i11 < 0 || i11 > bArr.length - i10) { throw new IndexOutOfBoundsException(); } if (i11 == 0) { return 0; } do { int read = this.f13459b.read(bArr, i10, i11); if (read > 0) { return read; } c(); } while (this.f13459b != null); return -1; } }