Interface Protocol<T>

Type Parameters:
T - 消息对象实体类型
All Known Implementing Classes:
ByteArrayProtocol, FixedLengthBytesProtocol, StringProtocol

public interface Protocol<T>

消息传输采用的协议。

根据通信双方约定的协议规范实现Protocol接口,使用时将该实现类注册至服务启动类AioQuickClientAioQuickServer

注意:框架本身的所有Socket链路复用同一个Protocol,请勿在其实现类的成员变量中存储特定链路的数据。
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    decode(ByteBuffer readBuffer, AioSession session)
    对于从Socket流中获取到的数据采用当前Protocol的实现类协议进行解析。
  • Method Details

    • decode

      T decode(ByteBuffer readBuffer, AioSession session)
      对于从Socket流中获取到的数据采用当前Protocol的实现类协议进行解析。
      Parameters:
      readBuffer - 待处理的读buffer
      session - 本次需要解码的session
      Returns:
      本次解码成功后封装的业务消息对象, 返回null则表示解码未完成