public abstract class ProgressInputStream extends SdkFilterInputStream
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_NOTIFICATION_THRESHOLD
The threshold of bytes between notifications.
|
private boolean |
doneEOF |
private boolean |
hasBeenRead |
private ProgressListener |
listener |
private long |
notifiedByteCount |
private int |
notifyThresHold |
private int |
unnotifiedByteCount
The number of bytes read that the listener hasn't been notified about yet.
|
Constructor and Description |
---|
ProgressInputStream(java.io.InputStream is,
ProgressListener listener) |
ProgressInputStream(java.io.InputStream is,
ProgressListener listener,
int notifyThresHold) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
private void |
eof() |
ProgressListener |
getListener() |
protected long |
getNotifiedByteCount() |
protected int |
getUnnotifiedByteCount() |
java.io.InputStream |
getWrappedInputStream() |
static java.io.InputStream |
inputStreamForRequest(java.io.InputStream is,
AmazonWebServiceRequest req)
Returns an input stream for request progress tracking purposes.
|
static java.io.InputStream |
inputStreamForResponse(java.io.InputStream is,
AmazonWebServiceRequest req)
Returns an input stream for response progress tracking purposes.
|
private void |
onBytesRead(int bytesRead)
Upon reading the given number of bytes.
|
protected void |
onClose()
Defaults to behave the same as
onEOF() . |
protected void |
onEOF()
An end-of-file event is to be notified.
|
protected void |
onFirstRead()
The read method is called for the very first time.
|
protected void |
onNotifyBytesRead()
Upon notification of the number of bytes transferred since last
notification.
|
protected void |
onReset()
A reset event is to be notified.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
abort, abortIfNeeded, available, isMetricActivated, mark, markSupported, release, skip
private static final int DEFAULT_NOTIFICATION_THRESHOLD
private final ProgressListener listener
private final int notifyThresHold
private int unnotifiedByteCount
private boolean hasBeenRead
private boolean doneEOF
private long notifiedByteCount
public ProgressInputStream(java.io.InputStream is, ProgressListener listener)
public ProgressInputStream(java.io.InputStream is, ProgressListener listener, int notifyThresHold)
public static java.io.InputStream inputStreamForRequest(java.io.InputStream is, AmazonWebServiceRequest req)
is
- the request content input streampublic static java.io.InputStream inputStreamForResponse(java.io.InputStream is, AmazonWebServiceRequest req)
is
- the response content input streamprotected void onFirstRead()
protected void onEOF()
protected void onClose()
onEOF()
.protected void onReset()
protected void onNotifyBytesRead()
private void onBytesRead(int bytesRead)
onNotifyBytesRead()
if the count
has exceeded the threshold.public int read() throws java.io.IOException
read
in class SdkFilterInputStream
java.io.IOException
public void reset() throws java.io.IOException
reset
in class SdkFilterInputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class SdkFilterInputStream
java.io.IOException
private void eof()
public final java.io.InputStream getWrappedInputStream()
protected final int getUnnotifiedByteCount()
protected final long getNotifiedByteCount()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class SdkFilterInputStream
java.io.IOException
public final ProgressListener getListener()