Interface MessageEncoder<T>

Type Parameters:
T - the type of values to encode
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface MessageEncoder<T>
Encodes values of type T and writes them to a MessageSink.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    encode(T value, MessageSink sink)
    Encodes a value and writes it to a message sink.
    Returns a new message encoder that encodes strings.
  • Method Details

    • ofString

      static MessageEncoder<CharSequence> ofString()
      Returns a new message encoder that encodes strings.
      Returns:
      a new message encoder that encodes strings
    • encode

      void encode(T value, MessageSink sink) throws IOException
      Encodes a value and writes it to a message sink.
      Parameters:
      value - the value to encode
      sink - the message sink to write to
      Throws:
      IOException - if an I/O error occurs