public final class BinaryMessage extends AbstractWebSocketMessage<ByteBuffer>
Constructor and Description |
---|
BinaryMessage(byte[] payload)
Create a new binary WebSocket message with the given byte[] payload.
|
BinaryMessage(byte[] payload,
boolean isLast)
Create a new binary WebSocket message with the given byte[] payload representing
the full or partial message content.
|
BinaryMessage(byte[] payload,
int offset,
int length,
boolean isLast)
Create a new binary WebSocket message by wrapping an existing byte array.
|
BinaryMessage(ByteBuffer payload)
Create a new binary WebSocket message with the given ByteBuffer payload.
|
BinaryMessage(ByteBuffer payload,
boolean isLast)
Create a new binary WebSocket message with the given payload representing the
full or partial message content.
|
Modifier and Type | Method and Description |
---|---|
int |
getPayloadLength()
Return the number of bytes contained in the message.
|
protected String |
toStringPayload() |
equals, getPayload, hashCode, isLast, toString
public BinaryMessage(ByteBuffer payload)
payload
- the non-null payloadpublic BinaryMessage(ByteBuffer payload, boolean isLast)
isLast
boolean flag is set
to false
the message is sent as partial content and more partial
messages will be expected until the boolean flag is set to true
.payload
- the non-null payloadisLast
- if the message is the last of a series of partial messagespublic BinaryMessage(byte[] payload)
payload
- a non-null payload; note that this value is not copied so care
must be taken not to modify the array.public BinaryMessage(byte[] payload, boolean isLast)
isLast
boolean flag is set
to false
the message is sent as partial content and more partial
messages will be expected until the boolean flag is set to true
.payload
- a non-null payload; note that this value is not copied so care
must be taken not to modify the array.isLast
- if the message is the last of a series of partial messagespublic BinaryMessage(byte[] payload, int offset, int length, boolean isLast)
payload
- a non-null payload; note that this value is not copied so care
must be taken not to modify the array.offset
- the offset into the array where the payload startslength
- the length of the array considered for the payloadisLast
- if the message is the last of a series of partial messagespublic int getPayloadLength()
WebSocketMessage
protected String toStringPayload()
toStringPayload
in class AbstractWebSocketMessage<ByteBuffer>