public final class BinaryMessage extends WebSocketMessage<java.nio.ByteBuffer>
WebSocketMessage
that contains a binary ByteBuffer
payload.Modifier and Type | Field and Description |
---|---|
private byte[] |
bytes |
Constructor and Description |
---|
BinaryMessage(byte[] payload)
Create a new
BinaryMessage instance. |
BinaryMessage(byte[] payload,
boolean isLast)
Create a new
BinaryMessage instance. |
BinaryMessage(byte[] payload,
int offset,
int len,
boolean isLast)
Create a new
BinaryMessage instance by wrapping an existing byte array. |
BinaryMessage(java.nio.ByteBuffer payload)
Create a new
BinaryMessage instance. |
BinaryMessage(java.nio.ByteBuffer payload,
boolean isLast)
Create a new
BinaryMessage instance. |
Modifier and Type | Method and Description |
---|---|
byte[] |
getByteArray()
Returns access to the message payload as a byte array.
|
protected int |
getPayloadSize() |
private byte[] |
getRemainingBytes(java.nio.ByteBuffer payload) |
equals, getPayload, hashCode, isLast, toString
public BinaryMessage(java.nio.ByteBuffer payload)
BinaryMessage
instance.payload
- a non-null payloadpublic BinaryMessage(java.nio.ByteBuffer payload, boolean isLast)
BinaryMessage
instance.payload
- a non-null payloadisLast
- if the message is the last of a series of partial messagespublic BinaryMessage(byte[] payload)
BinaryMessage
instance.payload
- a non-null payloadpublic BinaryMessage(byte[] payload, boolean isLast)
BinaryMessage
instance.payload
- a non-null payloadisLast
- if the message is the last of a series of partial messagespublic BinaryMessage(byte[] payload, int offset, int len, boolean isLast)
BinaryMessage
instance by wrapping an existing byte array.payload
- a non-null payload, NOTE: this value is not copied so care must be
taken not to modify the array.offset
- the offet into the array where the payload startslen
- the length of the array considered for the payloadisLast
- if the message is the last of a series of partial messagespublic byte[] getByteArray()
private byte[] getRemainingBytes(java.nio.ByteBuffer payload)
protected int getPayloadSize()
getPayloadSize
in class WebSocketMessage<java.nio.ByteBuffer>