public class LineBasedFrameHandler extends Object implements PipeHandler<ByteBuf,ByteBuf>
ByteBufs on line endings.
Both "\n" and "\r\n" are handled.
The byte stream is expected to be in UTF-8 character encoding or ASCII. The current implementation
uses direct byte to char cast and then compares that char to a few low range
ASCII characters like '\n' or '\r'. UTF-8 is not using low range [0..0x7F]
byte values for multibyte codepoint representations therefore fully supported by this implementation.
| 构造器和说明 |
|---|
LineBasedFrameHandler()
Creates a new decoder. the maximum length is Integer.MAX_VALUE
|
LineBasedFrameHandler(int maxLength)
Creates a new decoder.
|
LineBasedFrameHandler(int maxLength,
boolean stripDelimiter)
Creates a new decoder.
|
| 限定符和类型 | 方法和说明 |
|---|---|
PipeStatus |
onMessage(PipeContext context,
PipeRcvQueue<ByteBuf> src,
PipeSndQueue<ByteBuf> dst) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonActive, onClose, onError, onInitpublic LineBasedFrameHandler()
public LineBasedFrameHandler(int maxLength)
maxLength - the maximum length of the decoded frame.
A TooLongFrameException is thrown if the length of the frame exceeds this value.public LineBasedFrameHandler(int maxLength,
boolean stripDelimiter)
maxLength - the maximum length of the decoded frame.
A TooLongFrameException is thrown if the length of the frame exceeds this value.stripDelimiter - whether the decoded frame should strip out the delimiter or notpublic PipeStatus onMessage(PipeContext context, PipeRcvQueue<ByteBuf> src, PipeSndQueue<ByteBuf> dst)
onMessage 在接口中 PipeHandler<ByteBuf,ByteBuf>Copyright © 2022–2024. All rights reserved.