package p5;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/* JADX INFO: renamed from: p5.i, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes3.dex */
public final class C2739i extends InputStream {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f23097a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ InterfaceC2742l f23098b;

    public /* synthetic */ C2739i(InterfaceC2742l interfaceC2742l, int i6) {
        this.f23097a = i6;
        this.f23098b = interfaceC2742l;
    }

    @Override // java.io.InputStream
    public final int available() throws IOException {
        switch (this.f23097a) {
            case 0:
                return (int) Math.min(((C2740j) this.f23098b).f23100b, Integer.MAX_VALUE);
            default:
                J j4 = (J) this.f23098b;
                if (j4.f23060c) {
                    throw new IOException("closed");
                }
                return (int) Math.min(j4.f23059b.f23100b, Integer.MAX_VALUE);
        }
    }

    @Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
    public final void close() {
        switch (this.f23097a) {
            case 0:
                break;
            default:
                ((J) this.f23098b).close();
                break;
        }
    }

    @Override // java.io.InputStream
    public final int read() throws IOException {
        switch (this.f23097a) {
            case 0:
                C2740j c2740j = (C2740j) this.f23098b;
                if (c2740j.f23100b > 0) {
                    return c2740j.y() & 255;
                }
                return -1;
            default:
                J j4 = (J) this.f23098b;
                if (j4.f23060c) {
                    throw new IOException("closed");
                }
                C2740j c2740j2 = j4.f23059b;
                if (c2740j2.f23100b == 0 && j4.f23058a.read(c2740j2, 8192L) == -1) {
                    return -1;
                }
                return c2740j2.y() & 255;
        }
    }

    public final String toString() {
        switch (this.f23097a) {
            case 0:
                return ((C2740j) this.f23098b) + ".inputStream()";
            default:
                return ((J) this.f23098b) + ".inputStream()";
        }
    }

    @Override // java.io.InputStream
    public long transferTo(OutputStream out) throws IOException {
        switch (this.f23097a) {
            case 1:
                kotlin.jvm.internal.o.h(out, "out");
                J j4 = (J) this.f23098b;
                if (j4.f23060c) {
                    throw new IOException("closed");
                }
                long j6 = 0;
                while (true) {
                    C2740j c2740j = j4.f23059b;
                    if (c2740j.f23100b == 0 && j4.f23058a.read(c2740j, 8192L) == -1) {
                        return j6;
                    }
                    long j7 = c2740j.f23100b;
                    j6 += j7;
                    c2740j.U(out, j7);
                }
                break;
            default:
                return super.transferTo(out);
        }
    }

    @Override // java.io.InputStream
    public final int read(byte[] sink, int i6, int i7) throws IOException {
        switch (this.f23097a) {
            case 0:
                kotlin.jvm.internal.o.h(sink, "sink");
                return ((C2740j) this.f23098b).t(sink, i6, i7);
            default:
                kotlin.jvm.internal.o.h(sink, "data");
                J j4 = (J) this.f23098b;
                if (!j4.f23060c) {
                    AbstractC2732b.e(sink.length, i6, i7);
                    C2740j c2740j = j4.f23059b;
                    if (c2740j.f23100b == 0 && j4.f23058a.read(c2740j, 8192L) == -1) {
                        return -1;
                    }
                    return c2740j.t(sink, i6, i7);
                }
                throw new IOException("closed");
        }
    }

    private final void a() {
    }
}
