Package software.amazon.eventstream
Class Message
- java.lang.Object
-
- software.amazon.eventstream.Message
-
public class Message extends Object
An eventstream message.
-
-
Constructor Summary
Constructors Constructor Description Message(Map<String,HeaderValue> headers, byte[] payload)Create a message.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Messagedecode(ByteBuffer buf)voidencode(OutputStream os)static byte[]encodeHeaders(Iterable<Map.Entry<String,HeaderValue>> headers)Encode the givenheaders, without any leading or trailing metadata such as checksums or lengths.booleanequals(Object o)Map<String,HeaderValue>getHeaders()Returns this message's headers.byte[]getPayload()Returns this message's payload.inthashCode()ByteBuffertoByteBuffer()StringtoString()
-
-
-
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 mappayload- 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 throughdecode(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 givenheaders, 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
headerssection of aMessage
-
-