Skip to content

Commit dcbc935

Browse files
committed
Fix debug method
1 parent 88e1410 commit dcbc935

3 files changed

Lines changed: 3 additions & 28 deletions

File tree

src/main/java/net/deanly/structlayout/StructLayout.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,12 @@ public static void debug(byte[] data) {
4343
System.out.println(hexDump);
4444
}
4545

46-
/**
47-
* Debugs an object by encoding it into a byte array using StructLayout.encode
48-
* and displaying it in a hex dump format.
49-
*
50-
* @param obj The Object to debug.
51-
*/
52-
public static void debug(Object obj) {
53-
if (obj == null) {
54-
System.out.println("[Object is null]");
55-
return;
56-
}
57-
try {
58-
// Object를 encode하여 byte[]로 변환
59-
byte[] encoded = StructEncoder.encode(obj);
60-
// 변환한 byte[]를 debug(byte[])로 전달
61-
debug(encoded);
62-
} catch (Exception e) {
63-
System.err.println("[Error encoding object: " + e.getMessage() + "]");
64-
}
65-
}
66-
6746
/**
6847
* Debugs the object by encoding it and providing a breakdown of each field.
6948
*
7049
* @param obj The object to debug.
7150
*/
72-
public static void debugWithFields(Object obj) {
51+
public static void debug(Object obj) {
7352
if (obj == null) {
7453
System.out.println("[Object is null]");
7554
return;

src/main/java/net/deanly/structlayout/codec/decode/handler/StructSequenceObjectFieldHandler.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,10 @@ public <T> int handleField(T instance, java.lang.reflect.Field field, byte[] dat
5959

6060
// 5. 개별 요소 디코드
6161
for (int i = 0; i < length; i++) {
62-
System.out.printf("Processing element %d of %d at offset %d%n", i, length, currentOffset);
63-
6462
StructDecodeResult<?> decodeResult = StructDecoder.decode(elementType, data, currentOffset);
6563
Object decodedValue = decodeResult.getValue();
6664
int decodedSize = decodeResult.getSize();
6765

68-
System.out.printf("Decoded element %d: value=%s, size=%d%n", i, decodedValue, decodedSize);
69-
7066
if (fieldType.isArray()) {
7167
Array.set(result, i, decodedValue);
7268
} else {

src/test/java/net/deanly/structlayout/BasicStructFieldTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void test() {
7676
System.out.println("Float Value: " + decodedStruct.getFloatValue());
7777

7878
// Debugging a byte array
79-
StructLayout.debugWithFields(decodedStruct);
79+
StructLayout.debug(decodedStruct);
8080
}
8181

8282
@Test
@@ -208,7 +208,7 @@ public void debugPrintingTest2() {
208208
StructLayout.debug(decodedStruct);
209209

210210
System.out.println("Debug with Field:");
211-
StructLayout.debugWithFields(decodedStruct);
211+
StructLayout.debug(decodedStruct);
212212
}
213213

214214
@Getter

0 commit comments

Comments
 (0)