Package okio

Class ForwardingTimeout

java.lang.Object
okio.Timeout
okio.ForwardingTimeout

public class ForwardingTimeout extends Timeout
A Timeout which forwards calls to another. Useful for subclassing.
  • Constructor Details

    • ForwardingTimeout

      public ForwardingTimeout(Timeout delegate)
  • Method Details

    • delegate

      public final Timeout delegate()
      Timeout instance 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: Timeout
      Wait at most timeout 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.)

      Overrides:
      timeout in class Timeout
    • timeoutNanos

      public long timeoutNanos()
      Description copied from class: Timeout
      Returns the timeout in nanoseconds, or 0 for no timeout.
      Overrides:
      timeoutNanos in class Timeout
    • hasDeadline

      public boolean hasDeadline()
      Description copied from class: Timeout
      Returns true if a deadline is enabled.
      Overrides:
      hasDeadline in class Timeout
    • deadlineNanoTime

      public long deadlineNanoTime()
      Description copied from class: Timeout
      Returns the nano time when the deadline will be reached.
      Overrides:
      deadlineNanoTime in class Timeout
    • deadlineNanoTime

      public Timeout deadlineNanoTime(long 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 class Timeout
    • clearTimeout

      public Timeout clearTimeout()
      Description copied from class: Timeout
      Clears the timeout. Operating system timeouts may still apply.
      Overrides:
      clearTimeout in class Timeout
    • clearDeadline

      public Timeout clearDeadline()
      Description copied from class: Timeout
      Clears the deadline.
      Overrides:
      clearDeadline in class Timeout
    • throwIfReached

      public void throwIfReached() throws IOException
      Description copied from class: Timeout
      Throws an InterruptedIOException 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 class Timeout
      Throws:
      IOException