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 aSubscriber
to aInputStream
.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 Summary
Constructors Constructor Description InputStreamSubscriber()
InputStreamSubscriber(ByteBufferStoringSubscriber delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
onComplete()
void
onError(Throwable t)
void
onNext(ByteBuffer byteBuffer)
void
onSubscribe(org.reactivestreams.Subscription s)
int
read()
int
read(byte[] b)
int
read(byte[] bytes, int off, int len)
-
Methods inherited from class java.io.InputStream
available, mark, markSupported, reset, skip
-
-
-
-
Constructor Detail
-
InputStreamSubscriber
public InputStreamSubscriber()
-
InputStreamSubscriber
public InputStreamSubscriber(ByteBufferStoringSubscriber delegate)
-
-
Method Detail
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription s)
- Specified by:
onSubscribe
in interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onNext
public void onNext(ByteBuffer byteBuffer)
- Specified by:
onNext
in interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onError
public void onError(Throwable t)
- Specified by:
onError
in interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onComplete
public void onComplete()
- Specified by:
onComplete
in interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] bytes, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
public void close()
Description copied from interface:SdkAutoCloseable
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSdkAutoCloseable
- Overrides:
close
in classInputStream
-
-