From e1e781bb2135ef78592226f1a3eaba4925702f1f Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 3 May 2021 16:38:41 -0700 Subject: :star: --- NET/worlds/network/ServerOutputStream.java | 171 +++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 NET/worlds/network/ServerOutputStream.java (limited to 'NET/worlds/network/ServerOutputStream.java') diff --git a/NET/worlds/network/ServerOutputStream.java b/NET/worlds/network/ServerOutputStream.java new file mode 100644 index 0000000..3fb4270 --- /dev/null +++ b/NET/worlds/network/ServerOutputStream.java @@ -0,0 +1,171 @@ +/* */ package NET.worlds.network; +/* */ +/* */ import java.io.FilterOutputStream; +/* */ import java.io.IOException; +/* */ import java.io.OutputStream; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class ServerOutputStream +/* */ extends FilterOutputStream +/* */ { +/* */ private int _version; +/* */ +/* */ public ServerOutputStream(OutputStream o) +/* */ { +/* 46 */ super(o); +/* 47 */ setVersion(24); +/* */ } +/* */ +/* */ public ServerOutputStream(OutputStream o, int vers) { +/* 51 */ super(o); +/* 52 */ setVersion(vers); +/* */ } +/* */ +/* */ public void setVersion(int vers) { +/* 56 */ this._version = vers; +/* */ } +/* */ +/* */ public int getVersion() { +/* 60 */ return this._version; +/* */ } +/* */ +/* */ +/* */ public final void write(int b) +/* */ throws IOException +/* */ { +/* 67 */ this.out.write(b); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public final void write(byte[] b, int off, int len) +/* */ throws IOException +/* */ { +/* 77 */ this.out.write(b, off, len); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public final void writeByte(int v) +/* */ throws IOException +/* */ { +/* 92 */ this.out.write(v); +/* */ } +/* */ +/* */ +/* */ +/* */ public final void writeShort(int v) +/* */ throws IOException +/* */ { +/* 100 */ OutputStream out = this.out; +/* 101 */ out.write(v >>> 8 & 0xFF); +/* 102 */ out.write(v >>> 0 & 0xFF); +/* */ } +/* */ +/* */ +/* */ +/* */ public final void writeInt(int v) +/* */ throws IOException +/* */ { +/* 110 */ OutputStream out = this.out; +/* 111 */ out.write(v >>> 24 & 0xFF); +/* 112 */ out.write(v >>> 16 & 0xFF); +/* 113 */ out.write(v >>> 8 & 0xFF); +/* 114 */ out.write(v >>> 0 & 0xFF); +/* */ } +/* */ +/* */ +/* */ +/* */ public static int utfLength(String str) +/* */ { +/* 121 */ int strlen = str.length(); +/* 122 */ int utflen = 0; +/* */ +/* 124 */ for (int i = 0; i < strlen; i++) { +/* 125 */ int c = str.charAt(i); +/* 126 */ if ((c >= 1) && (c <= 127)) { +/* 127 */ utflen++; +/* 128 */ } else if (c > 2047) { +/* 129 */ utflen += 3; +/* */ } else { +/* 131 */ utflen += 2; +/* */ } +/* */ } +/* 134 */ return utflen; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void writeUTF(String str) +/* */ throws IOException +/* */ { +/* 144 */ OutputStream out = this.out; +/* 145 */ int strlen = str.length(); +/* 146 */ int utflen = utfLength(str); +/* */ +/* 148 */ assert (utflen < 256); +/* */ +/* 150 */ out.write(utflen >>> 0 & 0xFF); +/* 151 */ for (int i = 0; i < strlen; i++) { +/* 152 */ int c = str.charAt(i); +/* 153 */ if ((c >= 1) && (c <= 127)) { +/* 154 */ out.write(c); +/* 155 */ } else if (c > 2047) { +/* 156 */ out.write(0xE0 | c >> 12 & 0xF); +/* 157 */ out.write(0x80 | c >> 6 & 0x3F); +/* 158 */ out.write(0x80 | c >> 0 & 0x3F); +/* */ } else { +/* 160 */ out.write(0xC0 | c >> 6 & 0x1F); +/* 161 */ out.write(0x80 | c >> 0 & 0x3F); +/* */ } +/* */ } +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\network\ServerOutputStream.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */ \ No newline at end of file -- cgit v1.2.3