接口 SockJsMessageCodec
public interface SockJsMessageCodec
Encode and decode messages to and from a SockJS message frame, essentially an array of JSON-encoded messages. For example:a["message1","message2"]
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
方法详细资料
encode
String encode(String... messages)
Encode the given messages as a SockJS message frame. Aside from applying standard JSON quoting to each message, there are some additional JSON Unicode escaping rules. See the "JSON Unicode Encoding" section of SockJS protocol (i.e. the protocol test suite).- 参数:
messages
- the messages to encode- 返回:
- the content for a SockJS message frame (never
null
)
decode
@Nullable String[] decode(String content) throws IOException
Decode the given SockJS message frame.- 参数:
content
- the SockJS message frame- 返回:
- an array of messages, or
null
if none - 抛出:
IOException
- if the content could not be parsed
decodeInputStream
@Nullable String[] decodeInputStream(InputStream content) throws IOException
Decode the given SockJS message frame.- 参数:
content
- the SockJS message frame- 返回:
- an array of messages, or
null
if none - 抛出:
IOException
- if the content could not be parsed