1 package org.djutils.decoderdumper.demo;
2
3 import java.io.IOException;
4
5 import org.djutils.decoderdumper.HexDumper;
6
7
8
9
10
11 public final class DecoderDumperDemos
12 {
13
14
15
16 private DecoderDumperDemos()
17 {
18
19 }
20
21
22
23
24
25
26 public static void main(final String[] args) throws IOException
27 {
28 byte[] bytes = new byte[] {10, 20, 0x04, (byte) 0xff, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'};
29 System.out.println(HexDumper.hexDumper(bytes));
30
31 System.out.println(HexDumper.hexDumper(123, bytes));
32
33 HexDumper hexDumper = new HexDumper();
34 hexDumper.setOutputStream(System.err);
35 hexDumper.append(bytes);
36 System.err.println("before flush");
37 hexDumper.flush();
38 System.err.println("adding more data");
39 byte[] moreBytes = new byte[] {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17};
40 hexDumper.append(moreBytes);
41 System.err.println("before 2nd flush");
42 hexDumper.flush();
43 }
44
45 }