Class InputStreamSubscriber

java.lang.Object
java.io.InputStream
software.amazon.awssdk.utils.async.InputStreamSubscriber
All Implemented Interfaces:
Closeable, AutoCloseable, org.reactivestreams.Subscriber<ByteBuffer>, SdkAutoCloseable

public final class InputStreamSubscriber extends InputStream implements org.reactivestreams.Subscriber<ByteBuffer>, SdkAutoCloseable
Adapts a Subscriber to a InputStream.

Reads from the stream will block until data is published to this subscriber. The amount of data stored in memory by this subscriber when the input stream is not being read is bounded.

  • Constructor Details

    • InputStreamSubscriber

      public InputStreamSubscriber()
  • Method Details

    • onSubscribe

      public void onSubscribe(org.reactivestreams.Subscription s)
      Specified by:
      onSubscribe in interface org.reactivestreams.Subscriber<ByteBuffer>
    • onNext

      public void onNext(ByteBuffer byteBuffer)
      Specified by:
      onNext in interface org.reactivestreams.Subscriber<ByteBuffer>
    • onError

      public void onError(Throwable t)
      Specified by:
      onError in interface org.reactivestreams.Subscriber<ByteBuffer>
    • onComplete

      public void onComplete()
      Specified by:
      onComplete in interface org.reactivestreams.Subscriber<ByteBuffer>
    • read

      public int read()
      Specified by:
      read in class InputStream
    • read

      public int read(byte[] b)
      Overrides:
      read in class InputStream
    • read

      public int read(byte[] bytes, int off, int len)
      Overrides:
      read in class InputStream
    • close

      public void close()
      Description copied from interface: SdkAutoCloseable
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface SdkAutoCloseable
      Overrides:
      close in class InputStream