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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* Created on 30.01.2004
*
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code Template
*/
package jake2.qcommon;
import jake2.Defines;
/**
* @author rst
*/
public class TestMSG extends MSG {
public static void main(String[] args) {
byte buf_data[] = new byte[Defines.MAX_MSGLEN];
sizebuf_t buf = new sizebuf_t();
SZ.Init(buf, buf_data, Defines.MAX_MSGLEN);
MSG.WriteInt(buf, 0x80000000);
MSG.WriteInt(buf, 0x12345678);
MSG.WriteInt(buf, 0x7fffffff);
MSG.WriteInt(buf, 0xffffffff);
MSG.WriteByte(buf, 1);
MSG.WriteByte(buf, 2);
MSG.WriteByte(buf, 3);
MSG.WriteByte(buf, 4);
SZ.Print(buf, "[einz]\n");
SZ.Print(buf, "[zwei]...");
MSG.WriteByte(buf, 0xfe);
MSG.WriteByte(buf, 4);
MSG.WriteShort(buf, 32766);
MSG.WriteShort(buf, 16384);
MSG.WriteShort(buf, -32768);
MSG.WriteFloat(buf, (float) Math.PI);
System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf)));
System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf)));
System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf)));
System.out.println("Read:" + Integer.toHexString(MSG.ReadLong(buf)));
System.out.println("Read:" + MSG.ReadByte(buf));
System.out.println("Read:" + MSG.ReadByte(buf));
System.out.println("Read:" + MSG.ReadByte(buf));
System.out.println("Read:" + MSG.ReadByte(buf));
System.out.println("Read:<" + MSG.ReadString(buf) + ">");
System.out.println("Read:" + MSG.ReadByte(buf));
System.out.println("Read:" + MSG.ReadByte(buf));
System.out.println("Read:" + MSG.ReadShort(buf));
System.out.println("Read:" + MSG.ReadShort(buf));
System.out.println("Read:" + MSG.ReadShort(buf));
System.out.println("Read:" + MSG.ReadFloat(buf));
}
}
|