package n4;

import java.io.EOFException;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import m4.AbstractC2494c;
import p5.C2740j;

/* JADX INFO: loaded from: classes3.dex */
public final class r extends AbstractC2494c {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final C2740j f21765a;

    public r(C2740j c2740j) {
        this.f21765a = c2740j;
    }

    @Override // m4.AbstractC2494c
    public final void A(int i6) {
        try {
            this.f21765a.J(i6);
        } catch (EOFException e6) {
            throw new IndexOutOfBoundsException(e6.getMessage());
        }
    }

    @Override // m4.AbstractC2494c, java.io.Closeable, java.lang.AutoCloseable
    public final void close() {
        this.f21765a.a();
    }

    @Override // m4.AbstractC2494c
    public final AbstractC2494c d(int i6) {
        C2740j c2740j = new C2740j();
        c2740j.write(this.f21765a, i6);
        return new r(c2740j);
    }

    @Override // m4.AbstractC2494c
    public final void f(OutputStream outputStream, int i6) throws IOException {
        this.f21765a.U(outputStream, i6);
    }

    @Override // m4.AbstractC2494c
    public final void g(ByteBuffer byteBuffer) {
        throw new UnsupportedOperationException();
    }

    @Override // m4.AbstractC2494c
    public final void i(byte[] bArr, int i6, int i7) {
        while (i7 > 0) {
            int iT = this.f21765a.t(bArr, i6, i7);
            if (iT == -1) {
                throw new IndexOutOfBoundsException(Z0.o.j(i7, "EOF trying to read ", " bytes"));
            }
            i7 -= iT;
            i6 += iT;
        }
    }

    @Override // m4.AbstractC2494c
    public final int t() {
        try {
            return this.f21765a.y() & 255;
        } catch (EOFException e6) {
            throw new IndexOutOfBoundsException(e6.getMessage());
        }
    }

    @Override // m4.AbstractC2494c
    public final int y() {
        return (int) this.f21765a.f23100b;
    }
}
