Package cn.sinozg.applet.instruct.util
Class InstructUtil
java.lang.Object
cn.sinozg.applet.instruct.util.InstructUtil
指令解析工具 通用
- Since:
- 2024-09-28 12:42
- Author:
- xyb
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate static final Map<Class<?>,InstructFieldCache> private static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Objectdecode(String s, Field field, InstructFieldDetail d) 解码private static ObjectdecodeField(String instruct, Field field, InstructFieldDetail d) 编码字段static <T> voiddecodeInstruct(String instruct, T t) 解码指令static <T> voiddecodeInstruct(String instruct, T t, boolean reverse) 解码指令static <T> StringencodedInstruct(T t) 编码指令static <T> StringencodedInstruct(T t, boolean reverse) 编码指令private static StringencodeField(Field field, Object data, InstructFieldDetail d) 编码指令static voiditemDecodeField(List<InstructFieldDetail> list, Object o, String instruct) 循环解码private static voiditemEncodeField(List<InstructFieldDetail> list, Object o, StringBuilder instruct) 循环编码static List<InstructFieldDetail>structureInfo(Class<?> clazz) 获取到指令结构static InstructFieldCachestructureInfo(Class<?> clazz, boolean reverse) 获取到指令结构static List<InstructFieldDetail>unknownStructure(List<InstructFieldDetail> list, int bs) 重新生成数据的结构体
-
Field Details
-
TWO
private static final int TWO- See Also:
-
STRUCTURE_MAP
-
log
private static final org.slf4j.Logger log
-
-
Constructor Details
-
InstructUtil
public InstructUtil()
-
-
Method Details
-
decodeInstruct
解码指令- Type Parameters:
T- 指令实体对象类型- Parameters:
instruct- 指令t- 指令实体对象
-
decodeInstruct
解码指令- Type Parameters:
T- 指令实体对象类型- Parameters:
instruct- 指令reverse- 子类在前还是在后t- 指令实体对象
-
encodedInstruct
编码指令- Type Parameters:
T- 对象类型- Parameters:
t- 对象- Returns:
- 指令
-
encodedInstruct
编码指令- Type Parameters:
T- 对象类型- Parameters:
t- 对象reverse- 子类在前还是在后- Returns:
- 指令
-
itemDecodeField
public static void itemDecodeField(List<InstructFieldDetail> list, Object o, String instruct) throws Exception 循环解码- Parameters:
list- 结构o- 数据instruct- 指令- Throws:
Exception- 异常
-
itemEncodeField
private static void itemEncodeField(List<InstructFieldDetail> list, Object o, StringBuilder instruct) throws Exception 循环编码- Parameters:
list- 结构体o- 对象instruct- 指令- Throws:
Exception- 异常
-
decodeField
编码字段- Parameters:
instruct- 指令field- 字段d- 字段信息- Returns:
- 值
-
decode
解码- Parameters:
s- 数据field- 字段d- 详情- Returns:
- 值
-
encodeField
编码指令- Parameters:
field- 字段data- 数据d- 对应的结构- Returns:
- 指令
-
structureInfo
获取到指令结构- Parameters:
clazz- 数据类型- Returns:
- 结构体
-
structureInfo
获取到指令结构- Parameters:
clazz- 数据类型reverse- 子类在前还是在后- Returns:
- 结构体 顺序
-
unknownStructure
重新生成数据的结构体- Parameters:
list- 数据bs- 未知的字节长- Returns:
- 新的结构
-