Package com.amazonaws.event
Class ProgressInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.amazonaws.internal.SdkFilterInputStream
-
- com.amazonaws.event.ProgressInputStream
-
- All Implemented Interfaces:
com.amazonaws.internal.MetricAware,com.amazonaws.internal.Releasable,Closeable,AutoCloseable
public abstract class ProgressInputStream extends com.amazonaws.internal.SdkFilterInputStreamUsed for input stream progress tracking purposes.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description ProgressInputStream(InputStream is, ProgressListener listener)ProgressInputStream(InputStream is, ProgressListener listener, int notifyThresHold)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()ProgressListenergetListener()protected longgetNotifiedByteCount()protected intgetUnnotifiedByteCount()InputStreamgetWrappedInputStream()static InputStreaminputStreamForRequest(InputStream is, AmazonWebServiceRequest req)Returns an input stream for request progress tracking purposes.static InputStreaminputStreamForResponse(InputStream is, AmazonWebServiceRequest req)Returns an input stream for response progress tracking purposes.protected voidonClose()Defaults to behave the same asonEOF().protected voidonEOF()An end-of-file event is to be notified.protected voidonFirstRead()The read method is called for the very first time.protected voidonNotifyBytesRead()Upon notification of the number of bytes transferred since last notification.protected voidonReset()A reset event is to be notified.intread()intread(byte[] b, int off, int len)voidreset()-
Methods inherited from class com.amazonaws.internal.SdkFilterInputStream
abort, abortIfNeeded, available, isMetricActivated, mark, markSupported, release, skip
-
Methods inherited from class java.io.FilterInputStream
read
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ProgressInputStream
public ProgressInputStream(InputStream is, ProgressListener listener)
-
ProgressInputStream
public ProgressInputStream(InputStream is, ProgressListener listener, int notifyThresHold)
-
-
Method Detail
-
inputStreamForRequest
public static InputStream inputStreamForRequest(InputStream is, AmazonWebServiceRequest req)
Returns an input stream for request progress tracking purposes. If request/response progress tracking is not enabled, this method simply return the given input stream as is.- Parameters:
is- the request content input stream
-
inputStreamForResponse
public static InputStream inputStreamForResponse(InputStream is, AmazonWebServiceRequest req)
Returns an input stream for response progress tracking purposes. If request/response progress tracking is not enabled, this method simply return the given input stream as is.- Parameters:
is- the response content input stream
-
onFirstRead
protected void onFirstRead()
The read method is called for the very first time. Defaults to do nothing.
-
onEOF
protected void onEOF()
An end-of-file event is to be notified. Defaults to do nothing.
-
onClose
protected void onClose()
Defaults to behave the same asonEOF().
-
onReset
protected void onReset()
A reset event is to be notified. Default to do nothing.
-
onNotifyBytesRead
protected void onNotifyBytesRead()
Upon notification of the number of bytes transferred since last notification. Default to do nothing.
-
read
public int read() throws IOException- Overrides:
readin classcom.amazonaws.internal.SdkFilterInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classcom.amazonaws.internal.SdkFilterInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classcom.amazonaws.internal.SdkFilterInputStream- Throws:
IOException
-
getWrappedInputStream
public final InputStream getWrappedInputStream()
-
getUnnotifiedByteCount
protected final int getUnnotifiedByteCount()
-
getNotifiedByteCount
protected final long getNotifiedByteCount()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classcom.amazonaws.internal.SdkFilterInputStream- Throws:
IOException
-
getListener
public final ProgressListener getListener()
-
-