public interface TioHandler
| Modifier and Type | Method and Description |
|---|---|
Packet |
decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext context)
根据ByteBuffer解码成业务需要的Packet对象.
|
ByteBuffer |
encode(Packet packet,
TioConfig tioConfig,
ChannelContext context)
编码
|
void |
handler(Packet packet,
ChannelContext context)
处理消息包
|
Packet decode(ByteBuffer buffer, int limit, int position, int readableLength, ChannelContext context) throws TioDecodeException
buffer - 参与本次希望解码的ByteBufferlimit - ByteBuffer的limitposition - ByteBuffer的position,不一定是0哦readableLength - ByteBuffer参与本次解码的有效数据(= limit - position)context - ChannelContextTioDecodeException - TioDecodeExceptionByteBuffer encode(Packet packet, TioConfig tioConfig, ChannelContext context)
packet - PackettioConfig - TioConfigcontext - ChannelContextvoid handler(Packet packet, ChannelContext context) throws Exception
packet - Packetcontext - ChannelContextException - ExceptionCopyright © 2025. All rights reserved.