public final class S3AbortableInputStream extends SdkFilterInputStream
| Constructor and Description |
|---|
S3AbortableInputStream(InputStream in,
org.apache.http.client.methods.HttpRequestBase httpRequest,
long contentLength) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Can be used to provide abortion logic prior to throwing the
AbortedException.
|
int |
available()
Returns the value of super.available() if the result is nonzero, or 1
otherwise.
|
void |
close()
Delegates to
S3ObjectInputStream.abort() if there is any data
remaining in the stream. |
void |
mark(int readlimit) |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
getDelegateStream, isMetricActivated, markSupported, releasepublic S3AbortableInputStream(InputStream in, org.apache.http.client.methods.HttpRequestBase httpRequest, long contentLength)
public void abort()
InputStream is also an instance
of this class, then it will also be aborted, otherwise this is a no-op.
Aborts the underlying http request without reading any more data and
closes the stream.
By default Apache HttpClient tries to reuse http connections by
reading to the end of an attached input stream on
InputStream.close(). This is efficient from a socket pool
management perspective, but for objects with large payloads can incur
significant overhead while bytes are read from s3 and discarded. It's up
to clients to decide when to take the performance hit implicit in not
reusing an http connection in order to not read unnecessary information
from S3.
abort in class SdkFilterInputStreamEofSensorInputStreampublic int available()
throws IOException
This is necessary to work around a known bug in GZIPInputStream.available(), which returns zero in some edge cases, causing file truncation.
Ref: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7036144
available in class SdkFilterInputStreamIOExceptionpublic int read()
throws IOException
read in class SdkFilterInputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read in class FilterInputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class SdkFilterInputStreamIOExceptionpublic void mark(int readlimit)
mark in class SdkFilterInputStreampublic void reset()
throws IOException
reset in class SdkFilterInputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class SdkFilterInputStreamIOExceptionpublic void close()
throws IOException
S3ObjectInputStream.abort() if there is any data
remaining in the stream. Otherwise, it safely closes the stream.close in interface Closeableclose in interface AutoCloseableclose in class SdkFilterInputStreamIOExceptionS3ObjectInputStream#abort()}