1 Clazz.load (["java.io.DataInput", "$.FilterInputStream"], "java.io.DataInputStream", ["java.io.EOFException", "$.PushbackInputStream", "$.UTFDataFormatException", "java.lang.Double", "$.Float", "$.IndexOutOfBoundsException"], function () {
\r
2 c$ = Clazz.decorateAsClass (function () {
\r
5 this.readBuffer = null;
\r
6 this.lineBuffer = null;
\r
7 Clazz.instantialize (this, arguments);
\r
8 }, java.io, "DataInputStream", java.io.FilterInputStream, java.io.DataInput);
\r
9 Clazz.prepareFields (c$, function () {
\r
10 this.bytearr = Clazz.newByteArray (80, 0);
\r
11 this.chararr = Clazz.newCharArray (80, '\0');
\r
12 this.readBuffer = Clazz.newByteArray (8, 0);
\r
14 Clazz.overrideMethod (c$, "read",
\r
15 function (b, off, len) {
\r
16 if (arguments.length == 1) { off = 0; len = b.length; }
\r
17 return this.$in.read (b, off, len);
\r
19 Clazz.defineMethod (c$, "readFully",
\r
20 function (b, off, len) {
\r
21 if (len < 0) throw new IndexOutOfBoundsException ();
\r
24 var count = this.$in.read (b, off + n, len - n);
\r
25 if (count < 0) throw new java.io.EOFException ();
\r
29 Clazz.overrideMethod (c$, "skipBytes",
\r
33 while ((total < n) && ((cur = this.$in.skip (n - total)) > 0)) {
\r
38 Clazz.overrideMethod (c$, "readBoolean",
\r
40 var ch = this.$in.readByteAsInt ();
\r
41 if (ch < 0) throw new java.io.EOFException ();
\r
44 Clazz.overrideMethod (c$, "readByte",
\r
46 var ch = this.$in.readByteAsInt ();
\r
47 if (ch < 0) throw new java.io.EOFException ();
\r
50 Clazz.overrideMethod (c$, "readUnsignedByte",
\r
52 var ch = this.$in.readByteAsInt ();
\r
53 if (ch < 0) throw new java.io.EOFException ();
\r
56 Clazz.overrideMethod (c$, "readShort",
\r
58 var ch1 = this.$in.readByteAsInt ();
\r
59 var ch2 = this.$in.readByteAsInt ();
\r
60 if ((ch1 | ch2) < 0) throw new java.io.EOFException ();
\r
61 var n = ((ch1 << 8) + (ch2 << 0));
\r
63 return (n > 0x7FFF ? n - 0x10000 : n);
\r
65 Clazz.defineMethod (c$, "readUnsignedShort",
\r
67 var ch1 = this.$in.readByteAsInt ();
\r
68 var ch2 = this.$in.readByteAsInt ();
\r
69 if ((ch1 | ch2) < 0) throw new java.io.EOFException ();
\r
70 return (ch1 << 8) + (ch2 << 0);
\r
72 Clazz.overrideMethod (c$, "readChar",
\r
74 var ch1 = this.$in.readByteAsInt ();
\r
75 var ch2 = this.$in.readByteAsInt ();
\r
76 if ((ch1 | ch2) < 0) throw new java.io.EOFException ();
\r
77 return String.fromCharCode ((ch1 << 8) + (ch2 << 0));
\r
79 Clazz.overrideMethod (c$, "readInt",
\r
81 var ch1 = this.$in.readByteAsInt ();
\r
82 var ch2 = this.$in.readByteAsInt ();
\r
83 var ch3 = this.$in.readByteAsInt ();
\r
84 var ch4 = this.$in.readByteAsInt ();
\r
85 if ((ch1 | ch2 | ch3 | ch4) < 0) throw new java.io.EOFException ();
\r
86 var n = ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
\r
88 return (n > 0x7FFFFFFF ? n - 0x100000000 : n);
\r
90 Clazz.overrideMethod (c$, "readLong",
\r
92 this.readFully (this.readBuffer, 0, 8);
\r
93 return ((this.readBuffer[0] << 56) + ((this.readBuffer[1] & 255) << 48) + ((this.readBuffer[2] & 255) << 40) + ((this.readBuffer[3] & 255) << 32) + ((this.readBuffer[4] & 255) << 24) + ((this.readBuffer[5] & 255) << 16) + ((this.readBuffer[6] & 255) << 8) + ((this.readBuffer[7] & 255) << 0));
\r
95 Clazz.overrideMethod (c$, "readFloat",
\r
97 return Float.intBitsToFloat (this.readInt ());
\r
99 Clazz.overrideMethod (c$, "readDouble",
\r
101 return Double.longBitsToDouble (this.readLong ());
\r
103 Clazz.overrideMethod (c$, "readLine",
\r
105 var buf = this.lineBuffer;
\r
107 buf = this.lineBuffer = Clazz.newCharArray (128, '\0');
\r
108 }var room = buf.length;
\r
111 loop : while (true) {
\r
112 switch (c = this.$in.readByteAsInt ()) {
\r
117 var c2 = this.$in.readByteAsInt ();
\r
118 if ((c2 != 10) && (c2 != -1)) {
\r
119 if (!(Clazz.instanceOf (this.$in, java.io.PushbackInputStream))) {
\r
120 this.$in = new java.io.PushbackInputStream (this.$in, 1);
\r
121 }(this.$in).unreadByte (c2);
\r
125 buf = Clazz.newCharArray (offset + 128, '\0');
\r
126 room = buf.length - offset - 1;
\r
127 System.arraycopy (this.lineBuffer, 0, buf, 0, offset);
\r
128 this.lineBuffer = buf;
\r
129 }buf[offset++] = String.fromCharCode (c);
\r
133 if ((c == -1) && (offset == 0)) {
\r
135 }return String.copyValueOf (buf, 0, offset);
\r
137 Clazz.overrideMethod (c$, "readUTF",
\r
139 return java.io.DataInputStream.readUTFBytes (this, -1);
\r
141 c$.readUTFBytes = Clazz.defineMethod (c$, "readUTFBytes",
\r
142 function ($in, utflen) {
\r
143 var isByteArray = (utflen >= 0);
\r
144 if (!isByteArray) utflen = $in.readUnsignedShort ();
\r
145 var bytearr = null;
\r
146 var chararr = null;
\r
147 if (Clazz.instanceOf ($in, java.io.DataInputStream)) {
\r
149 if (dis.bytearr.length < utflen) {
\r
150 dis.bytearr = Clazz.newByteArray (isByteArray ? utflen : utflen * 2, 0);
\r
151 dis.chararr = Clazz.newCharArray (dis.bytearr.length, '\0');
\r
152 }chararr = dis.chararr;
\r
153 bytearr = dis.bytearr;
\r
155 bytearr = Clazz.newByteArray (utflen, 0);
\r
156 chararr = Clazz.newCharArray (utflen, '\0');
\r
161 var chararr_count = 0;
\r
162 $in.readFully (bytearr, 0, utflen);
\r
163 while (count < utflen) {
\r
164 c = bytearr[count] & 0xff;
\r
165 if (c > 127) break;
\r
167 chararr[chararr_count++] = String.fromCharCode (c);
\r
169 while (count < utflen) {
\r
170 c = bytearr[count] & 0xff;
\r
181 chararr[chararr_count++] = String.fromCharCode (c);
\r
186 if (count > utflen) throw new java.io.UTFDataFormatException ("malformed input: partial character at end");
\r
187 char2 = bytearr[count - 1];
\r
188 if ((char2 & 0xC0) != 0x80) throw new java.io.UTFDataFormatException ("malformed input around byte " + count);
\r
189 chararr[chararr_count++] = String.fromCharCode (((c & 0x1F) << 6) | (char2 & 0x3F));
\r
193 if (count > utflen) throw new java.io.UTFDataFormatException ("malformed input: partial character at end");
\r
194 char2 = bytearr[count - 2];
\r
195 char3 = bytearr[count - 1];
\r
196 if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) throw new java.io.UTFDataFormatException ("malformed input around byte " + (count - 1));
\r
197 chararr[chararr_count++] = String.fromCharCode (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
\r
200 throw new java.io.UTFDataFormatException ("malformed input around byte " + count);
\r
203 return String.instantialize (chararr, 0, chararr_count);
\r
204 }, "java.io.DataInput,~N");
\r