package okio;

/* JADX INFO: renamed from: okio.InputStreamSource, reason: from toString */
/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0007\b\u0012\u0018\u00002\u00020\u0001B\u0017\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0006\u0010\u0007J\u001f\u0010\f\u001a\u00020\n2\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u000b\u001a\u00020\nH\u0016¢\u0006\u0004\b\f\u0010\rJ\u000f\u0010\u000f\u001a\u00020\u000eH\u0016¢\u0006\u0004\b\u000f\u0010\u0010J\u000f\u0010\u0005\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0005\u0010\u0011J\u000f\u0010\u0013\u001a\u00020\u0012H\u0016¢\u0006\u0004\b\u0013\u0010\u0014R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0015\u0010\u0016R\u0014\u0010\u0005\u001a\u00020\u00048\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0017\u0010\u0018¨\u0006\u0019"}, d2 = {"Lokio/InputStreamSource;", "Lokio/Source;", "Ljava/io/InputStream;", "input", "Lokio/Timeout;", "timeout", "<init>", "(Ljava/io/InputStream;Lokio/Timeout;)V", "Lokio/Buffer;", "sink", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "byteCount", "read", "(Lokio/Buffer;J)J", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "close", "()V", "()Lokio/Timeout;", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "toString", "()Ljava/lang/String;", "a", "Ljava/io/InputStream;", "b", "Lokio/Timeout;", "okio"}, k = 1, mv = {1, 9, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
class source implements okio.Source {

    /* JADX INFO: renamed from: a, reason: from kotlin metadata */
    private final java.io.InputStream input;

    /* JADX INFO: renamed from: b, reason: from kotlin metadata */
    private final okio.Timeout timeout;

    public source(java.io.InputStream inputStream, okio.Timeout timeout) {
        kotlin.jvm.internal.Intrinsics.l(inputStream, "input");
        kotlin.jvm.internal.Intrinsics.l(timeout, "timeout");
        this.input = inputStream;
        this.timeout = timeout;
    }

    @Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
    public void close() throws java.io.IOException {
        this.input.close();
    }

    @Override // okio.Source
    public long read(okio.Buffer sink, long byteCount) throws java.io.IOException {
        kotlin.jvm.internal.Intrinsics.l(sink, "sink");
        if (byteCount == 0) {
            return 0L;
        }
        if (byteCount < 0) {
            throw new java.lang.IllegalArgumentException(("byteCount < 0: " + byteCount).toString());
        }
        try {
            this.timeout.throwIfReached();
            okio.Segment segmentZ0 = sink.z0(1);
            int i = this.input.read(segmentZ0.data, segmentZ0.limit, (int) java.lang.Math.min(byteCount, 8192 - segmentZ0.limit));
            if (i != -1) {
                segmentZ0.limit += i;
                long j = i;
                sink.n0(sink.getSize() + j);
                return j;
            }
            if (segmentZ0.pos != segmentZ0.limit) {
                return -1L;
            }
            sink.head = segmentZ0.b();
            okio.SegmentPool.b(segmentZ0);
            return -1L;
        } catch (java.lang.AssertionError e) {
            if (okio.Okio.e(e)) {
                throw new java.io.IOException(e);
            }
            throw e;
        }
    }

    @Override // okio.Source
    /* JADX INFO: renamed from: timeout, reason: from getter */
    public okio.Timeout getTimeout() {
        return this.timeout;
    }

    public java.lang.String toString() {
        return "source(" + this.input + ')';
    }
}
