Class AbortableInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
software.amazon.awssdk.http.AbortableInputStream
All Implemented Interfaces:
Closeable, AutoCloseable, Abortable

public final class AbortableInputStream extends FilterInputStream implements Abortable
Input stream that can be aborted. Abort typically means to destroy underlying HTTP connection without reading more data. This may be desirable when the cost of reading the rest of the data exceeds that of establishing a new connection.
  • Method Details

    • create

      public static AbortableInputStream create(InputStream delegate, Abortable abortable)
      Creates an instance of AbortableInputStream.
      Parameters:
      delegate - the delegated input stream
      abortable - the abortable
      Returns:
      a new instance of AbortableInputStream
    • create

      public static AbortableInputStream create(InputStream delegate)
      Creates an instance of AbortableInputStream that ignores abort.
      Parameters:
      delegate - the delegated input stream
      Returns:
      a new instance of AbortableInputStream
    • createEmpty

      public static AbortableInputStream createEmpty()
    • abort

      public void abort()
      Description copied from interface: Abortable
      Aborts the execution of the task. Multiple calls to abort or calling abort an already aborted task should return without error.
      Specified by:
      abort in interface Abortable
    • delegate

      public InputStream delegate()
      Access the underlying delegate stream, for testing purposes.