Class AbstractBodyAdapter<B,S extends BaseSharedBuffer<?,?>>

java.lang.Object
io.micronaut.http.body.AbstractBodyAdapter<B,S>
Type Parameters:
B - The input buffer type
S - The output BaseSharedBuffer the buffers are forwarded to
All Implemented Interfaces:
BufferConsumer.Upstream, Subscriber<B>
Direct Known Subclasses:
ByteBufferBodyAdapter, NettyBodyAdapter

@Internal public abstract class AbstractBodyAdapter<B,S extends BaseSharedBuffer<?,?>> extends Object implements BufferConsumer.Upstream, Subscriber<B>
Base implementation for an adapter that transforms a Publisher of buffers to a ByteBody.
Since:
4.8.0
Author:
Jonas Konrad
  • Field Details

  • Constructor Details

  • Method Details

    • start

      public final void start()
      Description copied from interface: BufferConsumer.Upstream
      Signal that we want to start consuming bytes. This is an optional hint to the upstream, the upstream may ignore it and send bytes immediately. This is used for CONTINUE support.
      Specified by:
      start in interface BufferConsumer.Upstream
    • onBytesConsumed

      public final void onBytesConsumed(long bytesConsumed)
      Description copied from interface: BufferConsumer.Upstream
      Called when a number of bytes has been consumed by the downstream. Note that this can exceed the actual number of bytes written so far, if the downstream wants to signal it is ready consume much more data.
      Specified by:
      onBytesConsumed in interface BufferConsumer.Upstream
      Parameters:
      bytesConsumed - The number of bytes that were consumed
    • allowDiscard

      public final void allowDiscard()
      Description copied from interface: BufferConsumer.Upstream
      Allow the upstream to discard any further messages. Note that this does not actually mean the messages must be discarded: If another consumer still needs the body data, it may continue to be read and continue to be forwarded to this consumer.
      Specified by:
      allowDiscard in interface BufferConsumer.Upstream
    • disregardBackpressure

      public final void disregardBackpressure()
      Description copied from interface: BufferConsumer.Upstream
      Instruct the upstream to ignore backpressure from this consumer. This is slightly different from onBytesConsumed(Long.MAX_VALUE): If there are two consumers in ByteBody.SplitBackpressureMode.FASTEST mode, a MAX_VALUE requests all data from the common upstream, while a disregardBackpressure removes this downstream from consideration.
      Specified by:
      disregardBackpressure in interface BufferConsumer.Upstream
    • onSubscribe

      public final void onSubscribe(Subscription s)
      Specified by:
      onSubscribe in interface Subscriber<B>
    • onError

      public void onError(Throwable t)
      Specified by:
      onError in interface Subscriber<B>
    • onComplete

      public void onComplete()
      Specified by:
      onComplete in interface Subscriber<B>