Package org.miaixz.bus.socket
Interface Protocol<T>
- Type Parameters:
T- 消息对象实体类型
- All Known Implementing Classes:
ByteArrayProtocol,FixedLengthBytesProtocol,StringProtocol
public interface Protocol<T>
消息传输采用的协议。
根据通信双方约定的协议规范实现Protocol接口,使用时将该实现类注册至服务启动类AioQuickClient、AioQuickServer。
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescriptiondecode(ByteBuffer readBuffer, AioSession session) 对于从Socket流中获取到的数据采用当前Protocol的实现类协议进行解析。
-
Method Details
-
decode
对于从Socket流中获取到的数据采用当前Protocol的实现类协议进行解析。- Parameters:
readBuffer- 待处理的读buffersession- 本次需要解码的session- Returns:
- 本次解码成功后封装的业务消息对象, 返回null则表示解码未完成
-