public class StompSubframeDecoder extends ReplayingDecoder<io.netty.handler.codec.stomp.StompSubframeDecoder.State>
ByteBuf
s解码为StompHeadersSubframe
s和StompContentSubframe
s。
maxLineLength
的最大长度 - 限制命令行和标题行的长度如果初始行的长度超过此值,则会引发TooLongFrameException
。
maxChunkSize
内容或每个块的最大长度。
如果内容长度(或每个块的长度)超过此值,则内容或块将被拆分为最大长度为maxChunkSize
多个StompContentSubframe
。
maxChunkSize
,则HTTP消息的传输编码为“分块”,此解码器会生成多个StompContentSubframe
实例以避免过多的内存消耗。
请注意,即使没有内容,每条消息最后都会解码LastStompContentSubframe
以简化上游消息解析。
ByteToMessageDecoder.Cumulator
ChannelHandler.Sharable
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
Constructor and Description |
---|
StompSubframeDecoder() |
StompSubframeDecoder(boolean validateHeaders) |
StompSubframeDecoder(int maxLineLength, int maxChunkSize) |
StompSubframeDecoder(int maxLineLength, int maxChunkSize, boolean validateHeaders) |
Modifier and Type | Method and Description |
---|---|
protected void |
decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out)
解码从一个 ByteBuf 到另一个。
|
callDecode, checkpoint, checkpoint, state, state
actualReadableBytes, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
ensureNotSharable, handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
public StompSubframeDecoder()
public StompSubframeDecoder(boolean validateHeaders)
public StompSubframeDecoder(int maxLineLength, int maxChunkSize)
public StompSubframeDecoder(int maxLineLength, int maxChunkSize, boolean validateHeaders)
protected void decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
ByteToMessageDecoder
decode
在课程
ByteToMessageDecoder
ctx
- 这ByteToMessageDecoder
所属的ChannelHandlerContext
in
- 从中读取数据的ByteBuf
out
- 应该添加解码消息的
List
java.lang.Exception
- 发生错误时抛出
Copyright © 2008–2018 The Netty Project. All rights reserved.