package x7;

import d5.AbstractC0844a;
import java.io.InterruptedIOException;
import java.util.concurrent.TimeUnit;

/* JADX INFO: loaded from: classes.dex */
public class J {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final I f18740d = new I();

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public boolean f18741a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public long f18742b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public long f18743c;

    public J a() {
        this.f18741a = false;
        return this;
    }

    public J b() {
        this.f18743c = 0L;
        return this;
    }

    public long c() {
        if (this.f18741a) {
            return this.f18742b;
        }
        throw new IllegalStateException("No deadline");
    }

    public J d(long j8) {
        this.f18741a = true;
        this.f18742b = j8;
        return this;
    }

    public boolean e() {
        return this.f18741a;
    }

    public void f() throws InterruptedIOException {
        if (Thread.currentThread().isInterrupted()) {
            throw new InterruptedIOException("interrupted");
        }
        if (this.f18741a && this.f18742b - System.nanoTime() <= 0) {
            throw new InterruptedIOException("deadline reached");
        }
    }

    public J g(long j8) {
        TimeUnit timeUnit = TimeUnit.MILLISECONDS;
        P6.g.e(timeUnit, "unit");
        if (j8 < 0) {
            throw new IllegalArgumentException(AbstractC0844a.i(j8, "timeout < 0: ").toString());
        }
        this.f18743c = timeUnit.toNanos(j8);
        return this;
    }
}
