From 77e54aec65693683bc2b9ac50e08df6a06c53493 Mon Sep 17 00:00:00 2001
From: L <L@132>
Date: 星期三, 22 四月 2026 17:03:38 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/common/utils/Struct.java | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/Struct.java b/src/main/java/com/zy/common/utils/Struct.java
index 1f5adad..6057544 100644
--- a/src/main/java/com/zy/common/utils/Struct.java
+++ b/src/main/java/com/zy/common/utils/Struct.java
@@ -244,7 +244,7 @@
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T extends Struct> T decode(Class<? extends Struct> cls,byte[] bytes) throws Exception{
- Struct instance = cls.newInstance();
+ Struct instance = cls.getDeclaredConstructor().newInstance();
return instance.decode(bytes);
}
@@ -370,6 +370,8 @@
instance.unusedBytes = unusedBytes;
return (T) instance;
}
+
+ // 瀛楄妭鏁扮粍 ===>> 杞负鍗佸叚杩涘埗瀛楃涓�
public static String toHex(byte[] bytes) {
StringBuilder buf = new StringBuilder(bytes.length * 2);
for(byte b : bytes) { // 浣跨敤String鐨刦ormat鏂规硶杩涜杞崲
@@ -444,7 +446,6 @@
}
return bbt;
}
-
public static class TestMessage {
public @size(1) byte begin = 0x7e;//璧峰绗�
--
Gitblit v1.9.1