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 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 TypeMethodDescriptionvoid
void
void
onNext
(ByteBuffer byteBuffer) void
onSubscribe
(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:
onSubscribe
in interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onNext
- Specified by:
onNext
in interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onError
- Specified by:
onError
in interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-
onComplete
public void onComplete()- Specified by:
onComplete
in interfaceorg.reactivestreams.Subscriber<ByteBuffer>
-