Class ContentLengthAwareSubscriber
- java.lang.Object
-
- software.amazon.awssdk.utils.async.ContentLengthAwareSubscriber
-
- All Implemented Interfaces:
org.reactivestreams.Subscriber<ByteBuffer>
public final class ContentLengthAwareSubscriber extends Object implements org.reactivestreams.Subscriber<ByteBuffer>
Decorator subscriber that limits the number of bytes sent to the wrapped subscriber to at mostcontentLength. Once the given content length is reached, the upstream subscription is cancelled, and the wrapped subscriber is completed.
-
-
Constructor Summary
Constructors Constructor Description ContentLengthAwareSubscriber(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber, long contentLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonComplete()voidonError(Throwable throwable)voidonNext(ByteBuffer byteBuffer)voidonSubscribe(org.reactivestreams.Subscription subscription)
-
-
-
Constructor Detail
-
ContentLengthAwareSubscriber
public ContentLengthAwareSubscriber(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber, long contentLength)
-
-
Method Detail
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription subscription)
- Specified by:
onSubscribein interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onNext
public void onNext(ByteBuffer byteBuffer)
- Specified by:
onNextin interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onError
public void onError(Throwable throwable)
- Specified by:
onErrorin interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onComplete
public void onComplete()
- Specified by:
onCompletein interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
-