Package okio

Class ForwardingTimeout


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

      • ForwardingTimeout

        public ForwardingTimeout​(Timeout delegate)
    • Method Detail

      • delegate

        public final Timeout delegate()
        Timeout instance to which this instance is currently delegating.
      • timeout

        public Timeout timeout​(long timeout,
                               java.util.concurrent.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
      • throwIfReached

        public void throwIfReached()
                            throws java.io.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:
        java.io.IOException