Package org.springframework.web.socket
Class TextMessage
java.lang.Object
org.springframework.web.socket.AbstractWebSocketMessage<String>
org.springframework.web.socket.TextMessage
- All Implemented Interfaces:
- WebSocketMessage<String>
A text WebSocket message.
- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionTextMessage(byte[] payload) Create a new text WebSocket message from the given byte[].TextMessage(CharSequence payload) Create a new text WebSocket message from the given CharSequence payload.TextMessage(CharSequence payload, boolean isLast) Create a new text WebSocket message with the given payload representing the full or partial message content.
- 
Method SummaryMethods inherited from class org.springframework.web.socket.AbstractWebSocketMessageequals, getPayload, hashCode, isLast, toString
- 
Constructor Details- 
TextMessageCreate a new text WebSocket message from the given CharSequence payload.- Parameters:
- payload- the non-null payload
 
- 
TextMessagepublic TextMessage(byte[] payload) Create a new text WebSocket message from the given byte[]. It is assumed the byte array can be encoded into an UTF-8 String.- Parameters:
- payload- the non-null payload
 
- 
TextMessageCreate a new text 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- whether this the last part of a series of partial messages
 
 
- 
- 
Method Details- 
getPayloadLengthpublic int getPayloadLength()Description copied from interface:WebSocketMessageReturn the number of bytes contained in the message.
- 
asBytespublic byte[] asBytes()
- 
toStringPayload- Specified by:
- toStringPayloadin class- AbstractWebSocketMessage<String>
 
 
-