public class ProgressReportingInputStream
extends com.amazonaws.internal.SdkFilterInputStream
This class could be used for both Amazon S3 and Amazon Glacier clients. The legacy Amazon Amazon S3 com.amazonaws.services.s3.internal.ProgressReportingInputStream has been deprecated in favor of this new class.
| Constructor and Description |
|---|
ProgressReportingInputStream(java.io.InputStream in,
ProgressListenerCallbackExecutor listenerCallbackExecutor)
Creates a new progress reporting input stream that simply wraps the
specified input stream and uses the specified listener callback executor
to asynchronously notify the listener about the number of bytes
transferred.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
getFireCompletedEvent()
Returns whether this input stream should fire an event with code
ProgressEvent.COMPLETED_EVENT_CODE when this stream runs out of
data. |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
void |
setFireCompletedEvent(boolean fireCompletedEvent)
Sets whether this input stream should fire an event with code
ProgressEvent.COMPLETED_EVENT_CODE when this stream runs out of
data. |
void |
setNotificationThreshold(int threshold)
Sets the number of Kbytes that need to be written before updates to the
listener occur.
|
public ProgressReportingInputStream(java.io.InputStream in,
ProgressListenerCallbackExecutor listenerCallbackExecutor)
in - The input stream to wrap.listenerCallbackExecutor - The listener callback executor that wraps
the listener to notify about progress.public void setNotificationThreshold(int threshold)
threshold - Number of Kbytes that needs to be written before
write update notification occurs.public void setFireCompletedEvent(boolean fireCompletedEvent)
ProgressEvent.COMPLETED_EVENT_CODE when this stream runs out of
data. By default, completed events are not fired by this stream.fireCompletedEvent - Whether this input stream should fire an event
to indicate that the stream has been fully read.public boolean getFireCompletedEvent()
ProgressEvent.COMPLETED_EVENT_CODE when this stream runs out of
data. By default, completed events are not fired by this stream.public int read()
throws java.io.IOException
read in class com.amazonaws.internal.SdkFilterInputStreamjava.io.IOExceptionpublic void reset()
throws java.io.IOException
reset in class com.amazonaws.internal.SdkFilterInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class com.amazonaws.internal.SdkFilterInputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class com.amazonaws.internal.SdkFilterInputStreamjava.io.IOExceptionCopyright © 2018 Amazon Web Services, Inc. All Rights Reserved.