Files
rr3-apk/decompiled/sources/okio/Timeout.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

79 lines
2.0 KiB
Java

package okio;
import java.io.InterruptedIOException;
import java.util.concurrent.TimeUnit;
/* loaded from: classes5.dex */
public class Timeout {
public static final Timeout NONE = new Timeout() { // from class: okio.Timeout.1
@Override // okio.Timeout
public Timeout deadlineNanoTime(long j) {
return this;
}
@Override // okio.Timeout
public void throwIfReached() {
}
@Override // okio.Timeout
public Timeout timeout(long j, TimeUnit timeUnit) {
return this;
}
};
public long deadlineNanoTime;
public boolean hasDeadline;
public long timeoutNanos;
public Timeout clearDeadline() {
this.hasDeadline = false;
return this;
}
public Timeout clearTimeout() {
this.timeoutNanos = 0L;
return this;
}
public Timeout deadlineNanoTime(long j) {
this.hasDeadline = true;
this.deadlineNanoTime = j;
return this;
}
public boolean hasDeadline() {
return this.hasDeadline;
}
public long timeoutNanos() {
return this.timeoutNanos;
}
public Timeout timeout(long j, TimeUnit timeUnit) {
if (j >= 0) {
if (timeUnit == null) {
throw new IllegalArgumentException("unit == null");
}
this.timeoutNanos = timeUnit.toNanos(j);
return this;
}
throw new IllegalArgumentException("timeout < 0: " + j);
}
public long deadlineNanoTime() {
if (this.hasDeadline) {
return this.deadlineNanoTime;
}
throw new IllegalStateException("No deadline");
}
public void throwIfReached() {
if (Thread.interrupted()) {
Thread.currentThread().interrupt();
throw new InterruptedIOException("interrupted");
}
if (this.hasDeadline && this.deadlineNanoTime - System.nanoTime() <= 0) {
throw new InterruptedIOException("deadline reached");
}
}
}