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