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.SdkFilterInputStream
Used for input stream progress tracking purposes.
  • Constructor Details

  • Method Details

    • 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 as onEOF().
    • 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:
      read in class com.amazonaws.internal.SdkFilterInputStream
      Throws:
      IOException
    • reset

      public void reset() throws IOException
      Overrides:
      reset in class com.amazonaws.internal.SdkFilterInputStream
      Throws:
      IOException
    • read

      public int read(byte[] b, int off, int len) throws IOException
      Overrides:
      read in class com.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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class com.amazonaws.internal.SdkFilterInputStream
      Throws:
      IOException
    • getListener

      public final ProgressListener getListener()