Skip to content

Commit d006b72

Browse files
authored
Refactor EBCDIC to ASCII example with logging
1 parent b0df8ea commit d006b72

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
import java.nio.charset.Charset;
1+
import org.slf4j.Logger;
2+
import org.slf4j.LoggerFactory;
3+
import java.nio.charset.Charset;
24

3-
class Main {
5+
public class EbcdicExample {
6+
private static final Logger logger = LoggerFactory.getLogger(EbcdicExample.class);
7+
48
public static void main(String[] args) {
59
// Example: EBCDIC bytes for "ABC" (in Cp037)
610
byte[] ebcdicBytes = new byte[] { (byte)0xC1, (byte)0xC2, (byte)0xC3 };
711

812
// Convert to String using EBCDIC Cp037 charset
913
String text = new String(ebcdicBytes, Charset.forName("Cp037"));
10-
System.out.println(text);
14+
logger.info(text);
1115
}
12-
}
16+
}

0 commit comments

Comments
 (0)