Interface Message

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
ByteArrayMessage, FileMessage, MultiMessage, StringMessage

public interface Message extends Closeable
Any type of encapsulated message.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The message should be closed when it is no longer needed.
    Gets a binary representation of this message.
    Gets a String representation of this message.
    boolean
    Two messages of the same type with the same body must be considered equal.
    Gets the message type.
    int
    The hash code must be consistent with equals.
  • Method Details

    • equals

      boolean equals(Object o)
      Two messages of the same type with the same body must be considered equal.
      Overrides:
      equals in class Object
    • hashCode

      int hashCode()
      The hash code must be consistent with equals.
      Overrides:
      hashCode in class Object
    • getMessageType

      MessageType getMessageType()
      Gets the message type.
    • encodeAsString

      String encodeAsString() throws IOException
      Gets a String representation of this message.
      Throws:
      IOException
    • encodeAsByteArray

      ByteArray encodeAsByteArray() throws IOException
      Gets a binary representation of this message.
      Throws:
      IOException
    • close

      void close() throws IOException
      The message should be closed when it is no longer needed.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException