summaryrefslogtreecommitdiff
path: root/NET/worlds/network/net2Property.java
blob: 8e5fad9667308ce4c1018d612560681c1195a252 (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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*     */ package NET.worlds.network;
/*     */ 
/*     */ import java.io.IOException;
/*     */ import java.io.UTFDataFormatException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class net2Property
/*     */ {
/*     */   private int _propID;
/*     */   protected int _flags;
/*     */   protected int _access;
/*     */   protected String _stringValue;
/*     */   protected byte[] _binValue;
/*     */   
/*     */   public net2Property(int p, int flags, int access, byte[] data)
/*     */   {
/*  52 */     this._propID = p;
/*  53 */     this._flags = flags;
/*  54 */     this._access = access;
/*  55 */     assert ((flags & 0x10) > 0);
/*  56 */     this._binValue = data;
/*  57 */     this._stringValue = null;
/*     */   }
/*     */   
/*     */   public net2Property(int p, int flags, int access, String data) {
/*  61 */     this._propID = p;
/*  62 */     this._flags = flags;
/*  63 */     this._access = access;
/*  64 */     assert ((flags & 0x10) == 0);
/*  65 */     this._stringValue = data;
/*  66 */     this._binValue = null;
/*     */   }
/*     */   
/*     */   public net2Property() {
/*  70 */     this._propID = 0;
/*  71 */     this._flags = 0;
/*  72 */     this._access = 0;
/*  73 */     this._stringValue = null;
/*  74 */     this._binValue = null;
/*     */   }
/*     */   
/*     */   public int property() {
/*  78 */     return this._propID;
/*     */   }
/*     */   
/*     */   public int flags() {
/*  82 */     return this._flags;
/*     */   }
/*     */   
/*     */   public int access() {
/*  86 */     return this._access;
/*     */   }
/*     */   
/*     */   public byte[] data() {
/*  90 */     if ((this._flags & 0x10) > 0) {
/*  91 */       return this._binValue;
/*     */     }
/*     */     
/*     */ 
/*  95 */     byte[] data = this._stringValue.getBytes();
/*  96 */     return data;
/*     */   }
/*     */   
/*     */   public String value()
/*     */   {
/* 101 */     if ((this._flags & 0x10) == 0) {
/* 102 */       return this._stringValue;
/*     */     }
/* 104 */     return new String(this._binValue);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   int packetSize()
/*     */   {
/* 111 */     if ((this._flags & 0x10) > 0) {
/* 112 */       assert (this._binValue != null);
/* 113 */       return 4 + this._binValue.length;
/*     */     }
/* 115 */     assert (this._stringValue != null);
/* 116 */     return 4 + ServerOutputStream.utfLength(this._stringValue);
/*     */   }
/*     */   
/*     */   void parseNetData(ServerInputStream data)
/*     */     throws IOException, UTFDataFormatException
/*     */   {
/* 122 */     this._propID = data.readUnsignedByte();
/* 123 */     this._flags = data.readUnsignedByte();
/* 124 */     this._access = data.readUnsignedByte();
/*     */     
/* 126 */     if ((this._flags & 0x10) > 0) {
/* 127 */       int size = data.readUnsignedByte();
/* 128 */       this._binValue = new byte[size];
/* 129 */       data.readFully(this._binValue);
/* 130 */       this._stringValue = null;
/*     */     }
/*     */     else {
/*     */       try {
/* 134 */         this._stringValue = data.readUTF();
/*     */       } catch (UTFDataFormatException e) {
/* 136 */         this._stringValue = "";
/*     */         
/* 138 */         throw e;
/*     */       }
/* 140 */       this._binValue = null;
/*     */     }
/*     */   }
/*     */   
/*     */   void send(ServerOutputStream o) throws IOException {
/* 145 */     o.writeByte(this._propID);
/* 146 */     o.writeByte(this._flags);
/* 147 */     o.writeByte(this._access);
/* 148 */     if ((this._flags & 0x10) > 0) {
/* 149 */       o.writeByte(this._binValue.length);
/* 150 */       o.write(this._binValue);
/*     */     } else {
/* 152 */       o.writeUTF(this._stringValue);
/*     */     }
/*     */   }
/*     */   
/* 156 */   private String flagString() { String out = "";
/* 157 */     if ((this._flags & 0x80) > 0)
/* 158 */       out = out + "DBSTORE ";
/* 159 */     if ((this._flags & 0x40) > 0)
/* 160 */       out = out + "AUTOUPDATE ";
/* 161 */     if ((this._flags & 0x20) > 0)
/* 162 */       out = out + "FINGER ";
/* 163 */     if ((this._flags & 0x10) > 0)
/* 164 */       out = out + "BINARY ";
/* 165 */     if (out.length() == 0)
/* 166 */       out = "NONE";
/* 167 */     return out;
/*     */   }
/*     */   
/*     */   private String accessString() {
/* 171 */     String out = "";
/* 172 */     if ((this._access & 0x1) > 0)
/* 173 */       out = out + "POSSESS ";
/* 174 */     if ((this._access & 0x2) > 0)
/* 175 */       out = out + "PRIVATE ";
/* 176 */     if (out.length() == 0)
/* 177 */       out = "NONE";
/* 178 */     return out;
/*     */   }
/*     */   
/*     */   public String toString()
/*     */   {
/* 183 */     String tmp = "#" + this._propID + " [" + flagString() + "/" + accessString() + 
/* 184 */       "] ";
/* 185 */     if ((this._flags & 0x10) == 0) {
/* 186 */       return tmp + this._stringValue;
/*     */     }
/*     */     
/* 189 */     tmp = tmp + "val=[";
/* 190 */     for (int i = 0; i < this._binValue.length; i++) {
/* 191 */       tmp = tmp + Integer.toString(this._binValue[i], 16) + " ";
/*     */     }
/* 193 */     return tmp + "] (" + this._binValue + ")";
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\net2Property.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */