/* */ 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 */