-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIPTest.java
More file actions
26 lines (22 loc) · 769 Bytes
/
IPTest.java
File metadata and controls
26 lines (22 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* Tests DNSIP and DNSIPParserDecorator by creating a DNSIP, filling it with
* fudge values, and wrapping it's serialized version in a DNSIPParserDecorator.
*
* @author Chris Blades
* @version 20/3/2010
*/
public class IPTest {
public static void main(String[] args) {
DNSIP ip = new DNSIPImpl("11.22.33.44");
byte[] bytes = ip.serialize();
Byte[] Bytes = new Byte[bytes.length];
for (int i = 0; i < bytes.length; i++) {
Bytes[i] = bytes[i];
}
IndexedArrayList<Byte> list = new IndexedArrayList<Byte>(Bytes);
DNSIPParserDecorator dec =
new DNSIPParserDecorator(list);
dec.parse();
System.out.println(dec.stateValues() + "\n" + list.getPosition());
}
}