Class Message


  • public class Message
    extends Object
    An eventstream message.
    • Constructor Detail

      • Message

        public Message​(Map<String,​HeaderValue> headers,
                       byte[] payload)
        Create a message.
        Parameters:
        headers - a non-null key-value map of headers, which will be encoded on the wire according to the iteration order of the given map
        payload - a non-null byte array containing zero or more bytes
    • Method Detail

      • getHeaders

        public Map<String,​HeaderValue> getHeaders()
        Returns this message's headers. If this message was obtained through decode(ByteBuffer), the iteration order of the headers is guaranteed to match the order in which the headers appeared on the wire.
        Returns:
        an unmodifiable non-null key-value map of this message's headers
      • getPayload

        public byte[] getPayload()
        Returns this message's payload.
        Returns:
        a non-null array of zero or more bytes
      • encodeHeaders

        public static byte[] encodeHeaders​(Iterable<Map.Entry<String,​HeaderValue>> headers)
        Encode the given headers, without any leading or trailing metadata such as checksums or lengths.
        Parameters:
        headers - a sequence of zero or more headers, which will be encoded in iteration order
        Returns:
        a byte array corresponding to the headers section of a Message
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object