Package okio
Class ForwardingTimeout
java.lang.Object
okio.Timeout
okio.ForwardingTimeout
A
Timeout
which forwards calls to another. Useful for subclassing.-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClears the deadline.Clears the timeout.long
Returns the nano time when the deadline will be reached.deadlineNanoTime
(long deadlineNanoTime) Sets the nano time when the deadline will be reached.final Timeout
delegate()
Timeout
instance to which this instance is currently delegating.boolean
Returns true if a deadline is enabled.final ForwardingTimeout
setDelegate
(Timeout delegate) void
Throws anInterruptedIOException
if the deadline has been reached or if the current thread has been interrupted.Wait at mosttimeout
time before aborting an operation.long
Returns the timeout in nanoseconds, or0
for no timeout.Methods inherited from class okio.Timeout
deadline, waitUntilNotified
-
Constructor Details
-
ForwardingTimeout
-
-
Method Details
-
delegate
Timeout
instance to which this instance is currently delegating. -
setDelegate
-
timeout
Description copied from class:Timeout
Wait at mosttimeout
time 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:Timeout
Returns the timeout in nanoseconds, or0
for no timeout.- Overrides:
timeoutNanos
in classTimeout
-
hasDeadline
public boolean hasDeadline()Description copied from class:Timeout
Returns true if a deadline is enabled.- Overrides:
hasDeadline
in classTimeout
-
deadlineNanoTime
public long deadlineNanoTime()Description copied from class:Timeout
Returns the nano time when the deadline will be reached.- Overrides:
deadlineNanoTime
in classTimeout
-
deadlineNanoTime
Description copied from class:Timeout
Sets 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:
deadlineNanoTime
in classTimeout
-
clearTimeout
Description copied from class:Timeout
Clears the timeout. Operating system timeouts may still apply.- Overrides:
clearTimeout
in classTimeout
-
clearDeadline
Description copied from class:Timeout
Clears the deadline.- Overrides:
clearDeadline
in classTimeout
-
throwIfReached
Description copied from class:Timeout
Throws anInterruptedIOException
if 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:
throwIfReached
in classTimeout
- Throws:
IOException
-