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 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 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 throwable)
      Specified by:
      onError in interface org.reactivestreams.Subscriber<ByteBuffer>
    • onComplete

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