blob: 9ba603ec80510dc2c76f83ecf28b10a2e435bbd5 (
plain) (
blame)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/* */ package NET.worlds.network;
/* */
/* */ import java.io.DataInputStream;
/* */ import java.io.IOException;
/* */ import java.io.PrintStream;
/* */ import java.io.UTFDataFormatException;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ class netData
/* */ {
/* */ private byte[] _data;
/* */ private int _packetSize;
/* */ private int _offset;
/* */
/* */ public netData(DataInputStream in)
/* */ {
/* */ try
/* */ {
/* 24 */ this._packetSize = in.readUnsignedByte();
/* 25 */ this._data = new byte['Ā'];
/* 26 */ in.readFully(this._data, 1, this._packetSize - 1);
/* 27 */ this._data[0] = ((byte)this._packetSize);
/* */
/* */
/* */ }
/* */ catch (Exception e)
/* */ {
/* */
/* 34 */ this._data = null;
/* 35 */ this._packetSize = 0;
/* */ }
/* 37 */ this._offset = 1;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public final int packetSize()
/* */ {
/* 46 */ return this._packetSize;
/* */ }
/* */
/* */ public final boolean isEmpty() {
/* 50 */ return this._offset >= this._packetSize;
/* */ }
/* */
/* */ public final byte getByte() {
/* 54 */ assert (this._offset < this._packetSize);
/* 55 */ return this._data[(this._offset++)];
/* */ }
/* */
/* */ public final short getShort() {
/* 59 */ assert (this._offset < this._packetSize);
/* 60 */ assert (this._offset + 1 < this._packetSize);
/* */
/* 62 */ short retVal = (short)(this._data[this._offset] << 8 | this._data[(this._offset + 1)] & 0xFF);
/* 63 */ this._offset += 2;
/* 64 */ return retVal;
/* */ }
/* */
/* */
/* */
/* */
/* */ public String getUTFString(int utflen)
/* */ {
/* 72 */ char[] str = new char[utflen];
/* 73 */ int count = 0;
/* 74 */ int strlen = 0;
/* */ try {
/* 76 */ while (count < utflen) {
/* 77 */ int c = getByte() & 0xFF;
/* */
/* 79 */ switch (c >> 4)
/* */ {
/* */ case 0:
/* */ case 1:
/* */ case 2:
/* */ case 3:
/* */ case 4:
/* */ case 5:
/* */ case 6:
/* */ case 7:
/* 89 */ count++;
/* 90 */ str[(strlen++)] = ((char)c);
/* 91 */ break;
/* */
/* */ case 12:
/* */ case 13:
/* 95 */ count += 2;
/* 96 */ if (count > utflen)
/* 97 */ throw new UTFDataFormatException();
/* 98 */ int char2 = getByte() & 0xFF;
/* 99 */ if ((char2 & 0xC0) != 128)
/* 100 */ throw new UTFDataFormatException();
/* 101 */ str[(strlen++)] = ((char)((c & 0x1F) << 6 | char2 & 0x3F));
/* 102 */ break;
/* */
/* */ case 14:
/* 105 */ count += 3;
/* 106 */ if (count > utflen)
/* 107 */ throw new UTFDataFormatException();
/* 108 */ int char2 = getByte() & 0xFF;
/* 109 */ int char3 = getByte() & 0xFF;
/* 110 */ if (((char2 & 0xC0) != 128) || ((char3 & 0xC0) != 128))
/* 111 */ throw new UTFDataFormatException();
/* 112 */ str[(strlen++)] =
/* 113 */ ((char)((c & 0xF) << 12 | (char2 & 0x3F) << 6 | (char3 & 0x3F) << 0));
/* */ case 8: case 9: case 10:
/* */ case 11: default:
/* 116 */ throw new UTFDataFormatException();
/* */ }
/* */ }
/* */ } catch (IOException e) {
/* 120 */ System.err.println("Exception: " + e.getMessage());
/* 121 */ e.printStackTrace();
/* 122 */ if (!$assertionsDisabled) throw new AssertionError();
/* */ }
/* 124 */ return new String(str, 0, strlen);
/* */ }
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\netData.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|