diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/network/net2Property.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/network/net2Property.java')
| -rw-r--r-- | NET/worlds/network/net2Property.java | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/NET/worlds/network/net2Property.java b/NET/worlds/network/net2Property.java new file mode 100644 index 0000000..8e5fad9 --- /dev/null +++ b/NET/worlds/network/net2Property.java @@ -0,0 +1,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 + */
\ No newline at end of file |