Class BinaryMessage
java.lang.Object
org.springframework.web.socket.AbstractWebSocketMessage<ByteBuffer>
org.springframework.web.socket.BinaryMessage
- All Implemented Interfaces:
- WebSocketMessage<ByteBuffer>
A binary WebSocket message.
- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionBinaryMessage(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.
- 
Method SummaryModifier and TypeMethodDescriptionintReturn the number of bytes contained in the message.protected StringMethods inherited from class AbstractWebSocketMessageequals, getPayload, hashCode, isLast, toString
- 
Constructor Details- 
BinaryMessageCreate a new binary WebSocket message with the given ByteBuffer payload.- Parameters:
- payload- the non-null payload
 
- 
BinaryMessageCreate a new binary WebSocket message with the given payload representing the full or partial message content. When theisLastboolean flag is set tofalsethe message is sent as partial content and more partial messages will be expected until the boolean flag is set totrue.- Parameters:
- payload- the non-null payload
- isLast- if the message is the last of a series of partial messages
 
- 
BinaryMessagepublic BinaryMessage(byte[] payload) Create a new binary WebSocket message with the given byte[] payload.- Parameters:
- payload- a non-null payload; note that this value is not copied so care must be taken not to modify the array.
 
- 
BinaryMessagepublic BinaryMessage(byte[] payload, boolean isLast) Create a new binary WebSocket message with the given byte[] payload representing the full or partial message content. When theisLastboolean flag is set tofalsethe message is sent as partial content and more partial messages will be expected until the boolean flag is set totrue.- Parameters:
- 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 messages
 
- 
BinaryMessagepublic BinaryMessage(byte[] payload, int offset, int length, boolean isLast) Create a new binary WebSocket message by wrapping an existing byte array.- Parameters:
- 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 starts
- length- the length of the array considered for the payload
- isLast- if the message is the last of a series of partial messages
 
 
- 
- 
Method Details- 
getPayloadLengthpublic int getPayloadLength()Description copied from interface:WebSocketMessageReturn the number of bytes contained in the message.
- 
toStringPayload- Specified by:
- toStringPayloadin class- AbstractWebSocketMessage<ByteBuffer>
 
 
-