blob: 8a83be8b47420bf5e95441c1d69401ce2bf2c85e (
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
|
package NET.worlds.network;
import java.io.IOException;
import java.io.UTFDataFormatException;
import java.util.Vector;
public class PropertyList {
private Vector<net2Property> _propList = new Vector<net2Property>();
public void addProperty(net2Property prop) {
this._propList.addElement(prop);
}
public int size() {
return this._propList.size();
}
public net2Property elementAt(int i) {
return this._propList.elementAt(i);
}
public net2Property getProperty(int propID) {
for (int i = this._propList.size() - 1; i >= 0; i--) {
if (this.elementAt(i).property() == propID) {
return this.elementAt(i);
}
}
return null;
}
void parseNetData(ServerInputStream data) throws IOException {
this._propList = new Vector<net2Property>();
while (!data.isEmpty()) {
try {
net2Property tmpProp = new net2Property();
tmpProp.parseNetData(data);
this._propList.addElement(tmpProp);
} catch (UTFDataFormatException var4) {
System.out.println("Property list discarded; invalid UTF property.");
this._propList.removeAllElements();
data.skipBytes(data.bytesLeft());
assert data.isEmpty();
return;
}
}
}
int packetSize() {
int len = 0;
for (int i = this._propList.size() - 1; i >= 0; i--) {
net2Property tmpProp = this._propList.elementAt(i);
len += tmpProp.packetSize();
}
return len;
}
void send(ServerOutputStream o) throws IOException {
int maxidx = this._propList.size();
for (int i = 0; i < maxidx; i++) {
net2Property tmpProp = this._propList.elementAt(i);
tmpProp.send(o);
}
}
@Override
public String toString() {
String out = "(";
int maxidx = this._propList.size();
for (int i = 0; i < maxidx; i++) {
net2Property tmpProp = this._propList.elementAt(i);
out = out + tmpProp + " ";
}
return out + ")";
}
}
|