Package software.amazon.awssdk.http
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.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
Aborts the execution of the task.static AbortableInputStream
create(InputStream delegate)
Creates an instance ofAbortableInputStream
that ignores abort.static AbortableInputStream
create(InputStream delegate, Abortable abortable)
Creates an instance ofAbortableInputStream
.static AbortableInputStream
createEmpty()
InputStream
delegate()
Access the underlying delegate stream, for testing purposes.-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, read, reset, skip
-
-
-
-
Method Detail
-
create
public static AbortableInputStream create(InputStream delegate, Abortable abortable)
Creates an instance ofAbortableInputStream
.- Parameters:
delegate
- the delegated input streamabortable
- the abortable- Returns:
- a new instance of AbortableInputStream
-
create
public static AbortableInputStream create(InputStream delegate)
Creates an instance ofAbortableInputStream
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.
-
delegate
public InputStream delegate()
Access the underlying delegate stream, for testing purposes.
-
-