Class ContentLengthAwareSubscriber
java.lang.Object
software.amazon.awssdk.utils.async.ContentLengthAwareSubscriber
- All Implemented Interfaces:
org.reactivestreams.Subscriber<ByteBuffer>
@SdkProtectedApi
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 most
contentLength. Once
the given content length is reached, the upstream subscription is cancelled, and the wrapped subscriber is completed.-
Constructor Summary
ConstructorsConstructorDescriptionContentLengthAwareSubscriber(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber, long contentLength) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidonNext(ByteBuffer byteBuffer) voidonSubscribe(org.reactivestreams.Subscription subscription)
-
Constructor Details
-
ContentLengthAwareSubscriber
public ContentLengthAwareSubscriber(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber, long contentLength)
-
-
Method Details
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription subscription) - Specified by:
onSubscribein interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onNext
- Specified by:
onNextin interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onError
- Specified by:
onErrorin interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-