Interface MessageDecoder<T>

Type Parameters:
T - the type of values decoded by this message decoder
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 MessageDecoder<T>
Reads values from a MessageSource and decodes them into values of type T.
  • Method Summary

    Modifier and Type
    Method
    Description
    Reads the next value from a message source and decodes it into a value of type T.
    Returns a new message decoder that decodes strings.
  • Method Details

    • ofString

      static MessageDecoder<String> ofString()
      Returns a new message decoder that decodes strings.
      Returns:
      a new message decoder that decodes strings
    • decode

      T decode(MessageSource source) throws IOException
      Reads the next value from a message source and decodes it into a value of type T.
      Parameters:
      source - the message source to read from
      Returns:
      the decoded value
      Throws:
      IOException - if an I/O error occurs