open class BufferingStompDecoder
An extension of org.springframework.messaging.simp.stomp.StompDecoder that buffers content remaining in the input ByteBuffer after the parent class has read all (complete) STOMP frames from it. The remaining content represents an incomplete STOMP frame. When called repeatedly with additional data, the decode method returns one or more messages or, if there is not enough data still, continues to buffer.
A single instance of this decoder can be invoked repeatedly to read all messages from a single stream (e.g. WebSocket session) as long as decoding does not fail. If there is an exception, StompDecoder instance should not be used any more as its internal state is not guaranteed to be consistent. It is expected that the underlying session is closed at that point.
Author
Rossen Stoyanchev
Since
4.0.3
See Also
StompDecoder
BufferingStompDecoder(stompDecoder: StompDecoder, bufferSizeLimit: Int)
Create a new |
open fun decode(newBuffer: ByteBuffer): MutableList<Message<ByteArray>>
Decodes one or more STOMP frames from the given If there was enough data to parse a "content-length" header, then the value is used to determine how much more data is needed before a new attempt to decode is made. If there was not enough data to parse the "content-length", or if there is "content-length" header, every subsequent call to decode attempts to parse again with all available data. Therefore the presence of a "content-length" header helps to optimize the decoding of large messages. |
|
open fun getBufferSize(): Int
Calculate the current buffer size. |
|
fun getBufferSizeLimit(): Int
Return the configured buffer size limit. |
|
open fun getExpectedContentLength(): Int
Get the expected content length of the currently buffered, incomplete STOMP frame. |
|
fun getStompDecoder(): StompDecoder
Return the wrapped StompDecoder. |