类 TextMessage
- java.lang.Object
- org.springframework.web.socket.AbstractWebSocketMessage<String>
- org.springframework.web.socket.TextMessage
- 所有已实现的接口:
WebSocketMessage<String>
public final class TextMessage extends AbstractWebSocketMessage<String>
A text WebSocket message.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 TextMessage(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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 byte[]
asBytes()
int
getPayloadLength()
Return the number of bytes contained in the message.protected String
toStringPayload()
从类继承的方法 org.springframework.web.socket.AbstractWebSocketMessage
equals, getPayload, hashCode, isLast, toString
构造器详细资料
TextMessage
public TextMessage(CharSequence payload)
Create a new text WebSocket message from the given CharSequence payload.- 参数:
payload
- the non-null payload
TextMessage
public 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.- 参数:
payload
- the non-null payload
TextMessage
public TextMessage(CharSequence payload, boolean isLast)
Create a new text WebSocket message with the given payload representing the full or partial message content. When theisLast
boolean flag is set tofalse
the message is sent as partial content and more partial messages will be expected until the boolean flag is set totrue
.- 参数:
payload
- the non-null payloadisLast
- whether this the last part of a series of partial messages
方法详细资料
getPayloadLength
public int getPayloadLength()
从接口复制的说明:WebSocketMessage
Return the number of bytes contained in the message.
asBytes
public byte[] asBytes()
toStringPayload
protected String toStringPayload()