Class FixedLengthBytesProtocol<T>

java.lang.Object
org.miaixz.bus.socket.protocol.FixedLengthBytesProtocol<T>
All Implemented Interfaces:
Protocol<T>
Direct Known Subclasses:
ByteArrayProtocol

public abstract class FixedLengthBytesProtocol<T> extends Object implements Protocol<T>
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • FixedLengthBytesProtocol

      public FixedLengthBytesProtocol()
  • Method Details

    • decode

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

      protected abstract T decode(byte[] bytes, AioSession session)