| 限定符和类型 | 字段和说明 |
|---|---|
protected byte |
code
协议ID
|
protected boolean |
lengthFixed
是否定长协议
|
protected String |
name
协议名称
|
static byte |
NET_PROTOCOL_HTTP
底层通讯协议:HTTP
|
static byte |
NET_PROTOCOL_TCP
底层通讯协议:TCP
|
static byte |
NET_PROTOCOL_UDP
底层通讯协议:UDP
|
protected byte |
netProtocol
协议底层通讯协议 是tcp还是udp还是http等
|
| 构造器和说明 |
|---|
ProtocolInfo(String name,
byte code,
boolean lengthFixed,
byte netProtocol)
Instantiates a new Protocol info.
|
| 限定符和类型 | 方法和说明 |
|---|---|
byte |
getCode()
返回协议ID
|
String |
getName()
返回协议名
|
byte |
getNetProtocol()
返回协议底层通讯协议
|
abstract int |
initialBytesToStrip()
跳过读取的位数,变长时使用
|
boolean |
isLengthFixed()
协议是否固定长度,true定长,false变长
|
abstract boolean |
isMatchMagic(byte[] bs)
是否命中魔术位
|
abstract int |
lengthAdjustment()
总长度调整位,变长时使用
|
abstract int |
lengthFieldLength()
“保存长度的字段”的长度,定长变长都适应
|
abstract int |
lengthFieldOffset()
找到“保存长度的字段”的偏移位,变长时使用
|
abstract byte[] |
magicCode()
返回魔术位信息
|
abstract int |
magicFieldLength()
魔术位字段长度,用于协议自适应
|
abstract int |
magicFieldOffset()
魔术位偏移量,用于协议自适应
|
abstract int |
maxFrameLength()
最大帧长度,变长时使用
|
public static final byte NET_PROTOCOL_TCP
public static final byte NET_PROTOCOL_UDP
public static final byte NET_PROTOCOL_HTTP
protected final String name
protected final byte code
protected final byte netProtocol
protected final boolean lengthFixed
public ProtocolInfo(String name, byte code, boolean lengthFixed, byte netProtocol)
name - the namecode - the codelengthFixed - the length fixednetProtocol - the net protocolpublic String getName()
public byte getCode()
public byte getNetProtocol()
public boolean isLengthFixed()
public abstract int maxFrameLength()
public abstract int lengthFieldOffset()
public abstract int lengthFieldLength()
public abstract int lengthAdjustment()
public abstract int initialBytesToStrip()
public abstract int magicFieldLength()
public abstract int magicFieldOffset()
public abstract byte[] magicCode()
public abstract boolean isMatchMagic(byte[] bs)
bs - origin byte[]Copyright © 2008–2018 The Ant Financial. All rights reserved.