Package okio
Class ForwardingTimeout
- java.lang.Object
-
- okio.Timeout
-
- okio.ForwardingTimeout
-
-
Constructor Summary
Constructors Constructor Description ForwardingTimeout(Timeout delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeoutclearDeadline()Clears the deadline.TimeoutclearTimeout()Clears the timeout.longdeadlineNanoTime()Returns the nano time when the deadline will be reached.TimeoutdeadlineNanoTime(long deadlineNanoTime)Sets the nano time when the deadline will be reached.Timeoutdelegate()Timeoutinstance to which this instance is currently delegating.booleanhasDeadline()Returns true if a deadline is enabled.ForwardingTimeoutsetDelegate(Timeout delegate)voidthrowIfReached()Throws anInterruptedIOExceptionif the deadline has been reached or if the current thread has been interrupted.Timeouttimeout(long timeout, TimeUnit unit)Wait at mosttimeouttime before aborting an operation.longtimeoutNanos()Returns the timeout in nanoseconds, or0for no timeout.
-
-
-
Constructor Detail
-
ForwardingTimeout
public ForwardingTimeout(Timeout delegate)
-
-
Method Detail
-
delegate
public final Timeout delegate()
Timeoutinstance to which this instance is currently delegating.
-
setDelegate
public final ForwardingTimeout setDelegate(Timeout delegate)
-
timeout
public Timeout timeout(long timeout, TimeUnit unit)
Description copied from class:TimeoutWait at mosttimeouttime before aborting an operation. Using a per-operation timeout means that as long as forward progress is being made, no sequence of operations will fail.If
timeout == 0, operations will run indefinitely. (Operating system timeouts may still apply.)
-
timeoutNanos
public long timeoutNanos()
Description copied from class:TimeoutReturns the timeout in nanoseconds, or0for no timeout.- Overrides:
timeoutNanosin classTimeout
-
hasDeadline
public boolean hasDeadline()
Description copied from class:TimeoutReturns true if a deadline is enabled.- Overrides:
hasDeadlinein classTimeout
-
deadlineNanoTime
public long deadlineNanoTime()
Description copied from class:TimeoutReturns the nano time when the deadline will be reached.- Overrides:
deadlineNanoTimein classTimeout
-
deadlineNanoTime
public Timeout deadlineNanoTime(long deadlineNanoTime)
Description copied from class:TimeoutSets the nano time when the deadline will be reached. All operations must complete before this time. Use a deadline to set a maximum bound on the time spent on a sequence of operations.- Overrides:
deadlineNanoTimein classTimeout
-
clearTimeout
public Timeout clearTimeout()
Description copied from class:TimeoutClears the timeout. Operating system timeouts may still apply.- Overrides:
clearTimeoutin classTimeout
-
clearDeadline
public Timeout clearDeadline()
Description copied from class:TimeoutClears the deadline.- Overrides:
clearDeadlinein classTimeout
-
throwIfReached
public void throwIfReached() throws IOExceptionDescription copied from class:TimeoutThrows anInterruptedIOExceptionif the deadline has been reached or if the current thread has been interrupted. This method doesn't detect timeouts; that should be implemented to asynchronously abort an in-progress operation.- Overrides:
throwIfReachedin classTimeout- Throws:
IOException
-
-