Class AbstractByteBufPublisherTemplateSet

java.lang.Object
io.inverno.mod.irt.AbstractTemplateSet
io.inverno.mod.irt.AbstractByteBufPublisherTemplateSet
All Implemented Interfaces:
ByteBufTemplateSet, PublisherTemplateSet<ByteBuf>, TemplateSet

public abstract class AbstractByteBufPublisherTemplateSet extends AbstractTemplateSet implements PublisherTemplateSet<ByteBuf>, ByteBufTemplateSet

A TemplateSet base implementation template sets which renders data in a reactive way using a ByteBuf sink.

This implementation allows to process rendered data without waiting for the whole data set to be rendered or even available following reactive programming principles.

Since:
1.2
Author:
Jeremy Kuhn
  • Field Details

    • sink

      protected final Sinks.Many<ByteBuf> sink
      The ByteBuf sink where rendered data are published
  • Constructor Details

    • AbstractByteBufPublisherTemplateSet

      protected AbstractByteBufPublisherTemplateSet(Charset charset)

      Creates a ByteBuf publisher template set.

      Parameters:
      charset - the charset to use to encode data
  • Method Details

    • getSink

      public Sinks.Many<ByteBuf> getSink()
      Description copied from interface: PublisherTemplateSet

      Returns the sink where rendered data are published.

      Specified by:
      getSink in interface PublisherTemplateSet<ByteBuf>
      Returns:
      the sink
    • render

      public CompletableFuture<Void> render(Object value)
      Description copied from interface: TemplateSet

      Renders an object to the output.

      This method might invoke specialized methods based on the actual type of the object. If no specific method is found the string representation of the object must be rendered.

      Specified by:
      render in interface TemplateSet
      Overrides:
      render in class AbstractTemplateSet
      Parameters:
      value - the object to render
      Returns:
      a future which completes once the value is rendered
    • render

      public CompletableFuture<Void> render(ByteBuf value)
      Description copied from interface: ByteBufTemplateSet

      Renders a ByteBuf to the output.

      Specified by:
      render in interface ByteBufTemplateSet
      Parameters:
      value - the ByteBuf to render
      Returns:
      a future which completes once the value is rendered
    • render

      public CompletableFuture<Void> render(String value)
      Description copied from interface: TemplateSet

      Renders a string to the output.

      Specified by:
      render in interface TemplateSet
      Parameters:
      value - the string to render
      Returns:
      a future which completes once the value is rendered
    • render

      public CompletableFuture<Void> render(byte[] value)
      Description copied from interface: TemplateSet

      Renders a byte array to the output.

      Specified by:
      render in interface TemplateSet
      Parameters:
      value - The byte array to render
      Returns:
      a future which completes once the value is rendered