Class Message

java.lang.Object
software.amazon.awssdk.eventstream.Message

@SdkProtectedApi public class Message extends Object
An eventstream message.
  • Field Details

  • Constructor Details

    • 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 Details

    • 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
    • decode

      public static Message decode(ByteBuffer buf)
    • toByteBuffer

      public ByteBuffer toByteBuffer()
    • encode

      public void encode(OutputStream os)
    • 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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object