Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / io / DataInputStream.js
index 6c31f63..f8b9456 100644 (file)
-Clazz.load (["java.io.DataInput", "$.FilterInputStream"], "java.io.DataInputStream", ["java.io.EOFException", "$.PushbackInputStream", "$.UTFDataFormatException", "java.lang.Double", "$.Float", "$.IndexOutOfBoundsException"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.bytearr = null;\r
-this.chararr = null;\r
-this.readBuffer = null;\r
-this.lineBuffer = null;\r
-Clazz.instantialize (this, arguments);\r
-}, java.io, "DataInputStream", java.io.FilterInputStream, java.io.DataInput);\r
-Clazz.prepareFields (c$, function () {\r
-this.bytearr =  Clazz.newByteArray (80, 0);\r
-this.chararr =  Clazz.newCharArray (80, '\0');\r
-this.readBuffer =  Clazz.newByteArray (8, 0);\r
-});\r
-Clazz.overrideMethod (c$, "read", \r
-function (b, off, len) {\r
-    if (arguments.length == 1) { off = 0; len = b.length; }\r
-return this.$in.read (b, off, len);\r
-}, "~A,~N,~N");\r
-Clazz.defineMethod (c$, "readFully", \r
-function (b, off, len) {\r
-if (len < 0) throw  new IndexOutOfBoundsException ();\r
-var n = 0;\r
-while (n < len) {\r
-var count = this.$in.read (b, off + n, len - n);\r
-if (count < 0) throw  new java.io.EOFException ();\r
-n += count;\r
-}\r
-}, "~A,~N,~N");\r
-Clazz.overrideMethod (c$, "skipBytes", \r
-function (n) {\r
-var total = 0;\r
-var cur = 0;\r
-while ((total < n) && ((cur = this.$in.skip (n - total)) > 0)) {\r
-total += cur;\r
-}\r
-return total;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "readBoolean", \r
-function () {\r
-var ch = this.$in.readByteAsInt ();\r
-if (ch < 0) throw  new java.io.EOFException ();\r
-return (ch != 0);\r
-});\r
-Clazz.overrideMethod (c$, "readByte", \r
-function () {\r
-var ch = this.$in.readByteAsInt ();\r
-if (ch < 0) throw  new java.io.EOFException ();\r
-return (ch);\r
-});\r
-Clazz.overrideMethod (c$, "readUnsignedByte", \r
-function () {\r
-var ch = this.$in.readByteAsInt ();\r
-if (ch < 0) throw  new java.io.EOFException ();\r
-return ch;\r
-});\r
-Clazz.overrideMethod (c$, "readShort", \r
-function () {\r
-var ch1 = this.$in.readByteAsInt ();\r
-var ch2 = this.$in.readByteAsInt ();\r
-if ((ch1 | ch2) < 0) throw  new java.io.EOFException ();\r
-var n = ((ch1 << 8) + (ch2 << 0));\r
-{\r
-return (n > 0x7FFF ? n - 0x10000 : n);\r
-}});\r
-Clazz.defineMethod (c$, "readUnsignedShort", \r
-function () {\r
-var ch1 = this.$in.readByteAsInt ();\r
-var ch2 = this.$in.readByteAsInt ();\r
-if ((ch1 | ch2) < 0) throw  new java.io.EOFException ();\r
-return (ch1 << 8) + (ch2 << 0);\r
-});\r
-Clazz.overrideMethod (c$, "readChar", \r
-function () {\r
-var ch1 = this.$in.readByteAsInt ();\r
-var ch2 = this.$in.readByteAsInt ();\r
-if ((ch1 | ch2) < 0) throw  new java.io.EOFException ();\r
-return String.fromCharCode ((ch1 << 8) + (ch2 << 0));\r
-});\r
-Clazz.overrideMethod (c$, "readInt", \r
-function () {\r
-var ch1 = this.$in.readByteAsInt ();\r
-var ch2 = this.$in.readByteAsInt ();\r
-var ch3 = this.$in.readByteAsInt ();\r
-var ch4 = this.$in.readByteAsInt ();\r
-if ((ch1 | ch2 | ch3 | ch4) < 0) throw  new java.io.EOFException ();\r
-var n = ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));\r
-{\r
-return (n > 0x7FFFFFFF ? n - 0x100000000 : n);\r
-}});\r
-Clazz.overrideMethod (c$, "readLong", \r
-function () {\r
-this.readFully (this.readBuffer, 0, 8);\r
-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
-});\r
-Clazz.overrideMethod (c$, "readFloat", \r
-function () {\r
-return Float.intBitsToFloat (this.readInt ());\r
-});\r
-Clazz.overrideMethod (c$, "readDouble", \r
-function () {\r
-return Double.longBitsToDouble (this.readLong ());\r
-});\r
-Clazz.overrideMethod (c$, "readLine", \r
-function () {\r
-var buf = this.lineBuffer;\r
-if (buf == null) {\r
-buf = this.lineBuffer =  Clazz.newCharArray (128, '\0');\r
-}var room = buf.length;\r
-var offset = 0;\r
-var c;\r
-loop : while (true) {\r
-switch (c = this.$in.readByteAsInt ()) {\r
-case -1:\r
-case '\n':\r
-break loop;\r
-case '\r':\r
-var c2 = this.$in.readByteAsInt ();\r
-if ((c2 != 10) && (c2 != -1)) {\r
-if (!(Clazz.instanceOf (this.$in, java.io.PushbackInputStream))) {\r
-this.$in =  new java.io.PushbackInputStream (this.$in, 1);\r
-}(this.$in).unreadByte (c2);\r
-}break loop;\r
-default:\r
-if (--room < 0) {\r
-buf =  Clazz.newCharArray (offset + 128, '\0');\r
-room = buf.length - offset - 1;\r
-System.arraycopy (this.lineBuffer, 0, buf, 0, offset);\r
-this.lineBuffer = buf;\r
-}buf[offset++] = String.fromCharCode (c);\r
-break;\r
-}\r
-}\r
-if ((c == -1) && (offset == 0)) {\r
-return null;\r
-}return String.copyValueOf (buf, 0, offset);\r
-});\r
-Clazz.overrideMethod (c$, "readUTF", \r
-function () {\r
-return java.io.DataInputStream.readUTFBytes (this, -1);\r
-});\r
-c$.readUTFBytes = Clazz.defineMethod (c$, "readUTFBytes", \r
-function ($in, utflen) {\r
-var isByteArray = (utflen >= 0);\r
-if (!isByteArray) utflen = $in.readUnsignedShort ();\r
-var bytearr = null;\r
-var chararr = null;\r
-if (Clazz.instanceOf ($in, java.io.DataInputStream)) {\r
-var dis = $in;\r
-if (dis.bytearr.length < utflen) {\r
-dis.bytearr =  Clazz.newByteArray (isByteArray ? utflen : utflen * 2, 0);\r
-dis.chararr =  Clazz.newCharArray (dis.bytearr.length, '\0');\r
-}chararr = dis.chararr;\r
-bytearr = dis.bytearr;\r
-} else {\r
-bytearr =  Clazz.newByteArray (utflen, 0);\r
-chararr =  Clazz.newCharArray (utflen, '\0');\r
-}var c;\r
-var char2;\r
-var char3;\r
-var count = 0;\r
-var chararr_count = 0;\r
-$in.readFully (bytearr, 0, utflen);\r
-while (count < utflen) {\r
-c = bytearr[count] & 0xff;\r
-if (c > 127) break;\r
-count++;\r
-chararr[chararr_count++] = String.fromCharCode (c);\r
-}\r
-while (count < utflen) {\r
-c = bytearr[count] & 0xff;\r
-switch (c >> 4) {\r
-case 0:\r
-case 1:\r
-case 2:\r
-case 3:\r
-case 4:\r
-case 5:\r
-case 6:\r
-case 7:\r
-count++;\r
-chararr[chararr_count++] = String.fromCharCode (c);\r
-break;\r
-case 12:\r
-case 13:\r
-count += 2;\r
-if (count > utflen) throw  new java.io.UTFDataFormatException ("malformed input: partial character at end");\r
-char2 = bytearr[count - 1];\r
-if ((char2 & 0xC0) != 0x80) throw  new java.io.UTFDataFormatException ("malformed input around byte " + count);\r
-chararr[chararr_count++] = String.fromCharCode (((c & 0x1F) << 6) | (char2 & 0x3F));\r
-break;\r
-case 14:\r
-count += 3;\r
-if (count > utflen) throw  new java.io.UTFDataFormatException ("malformed input: partial character at end");\r
-char2 = bytearr[count - 2];\r
-char3 = bytearr[count - 1];\r
-if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) throw  new java.io.UTFDataFormatException ("malformed input around byte " + (count - 1));\r
-chararr[chararr_count++] = String.fromCharCode (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));\r
-break;\r
-default:\r
-throw  new java.io.UTFDataFormatException ("malformed input around byte " + count);\r
-}\r
-}\r
-return  String.instantialize (chararr, 0, chararr_count);\r
-}, "java.io.DataInput,~N");\r
-});\r
+Clazz.load (["java.io.DataInput", "$.FilterInputStream"], "java.io.DataInputStream", ["java.io.EOFException", "$.PushbackInputStream", "$.UTFDataFormatException", "java.lang.Double", "$.Float", "$.IndexOutOfBoundsException"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.bytearr = null;
+this.chararr = null;
+this.readBuffer = null;
+this.lineBuffer = null;
+Clazz.instantialize (this, arguments);
+}, java.io, "DataInputStream", java.io.FilterInputStream, java.io.DataInput);
+Clazz.prepareFields (c$, function () {
+this.bytearr =  Clazz.newByteArray (80, 0);
+this.chararr =  Clazz.newCharArray (80, '\0');
+this.readBuffer =  Clazz.newByteArray (8, 0);
+});
+Clazz.overrideMethod (c$, "read", 
+function (b, off, len) {
+    if (arguments.length == 1) { off = 0; len = b.length; }
+return this.$in.read (b, off, len);
+}, "~A,~N,~N");
+Clazz.defineMethod (c$, "readFully", 
+function (b, off, len) {
+if (len < 0) throw  new IndexOutOfBoundsException ();
+var n = 0;
+while (n < len) {
+var count = this.$in.read (b, off + n, len - n);
+if (count < 0) throw  new java.io.EOFException ();
+n += count;
+}
+}, "~A,~N,~N");
+Clazz.overrideMethod (c$, "skipBytes", 
+function (n) {
+var total = 0;
+var cur = 0;
+while ((total < n) && ((cur = this.$in.skip (n - total)) > 0)) {
+total += cur;
+}
+return total;
+}, "~N");
+Clazz.overrideMethod (c$, "readBoolean", 
+function () {
+var ch = this.$in.readByteAsInt ();
+if (ch < 0) throw  new java.io.EOFException ();
+return (ch != 0);
+});
+Clazz.overrideMethod (c$, "readByte", 
+function () {
+var ch = this.$in.readByteAsInt ();
+if (ch < 0) throw  new java.io.EOFException ();
+return (ch);
+});
+Clazz.overrideMethod (c$, "readUnsignedByte", 
+function () {
+var ch = this.$in.readByteAsInt ();
+if (ch < 0) throw  new java.io.EOFException ();
+return ch;
+});
+Clazz.overrideMethod (c$, "readShort", 
+function () {
+var ch1 = this.$in.readByteAsInt ();
+var ch2 = this.$in.readByteAsInt ();
+if ((ch1 | ch2) < 0) throw  new java.io.EOFException ();
+var n = ((ch1 << 8) + (ch2 << 0));
+{
+return (n > 0x7FFF ? n - 0x10000 : n);
+}});
+Clazz.defineMethod (c$, "readUnsignedShort", 
+function () {
+var ch1 = this.$in.readByteAsInt ();
+var ch2 = this.$in.readByteAsInt ();
+if ((ch1 | ch2) < 0) throw  new java.io.EOFException ();
+return (ch1 << 8) + (ch2 << 0);
+});
+Clazz.overrideMethod (c$, "readChar", 
+function () {
+var ch1 = this.$in.readByteAsInt ();
+var ch2 = this.$in.readByteAsInt ();
+if ((ch1 | ch2) < 0) throw  new java.io.EOFException ();
+return String.fromCharCode ((ch1 << 8) + (ch2 << 0));
+});
+Clazz.overrideMethod (c$, "readInt", 
+function () {
+var ch1 = this.$in.readByteAsInt ();
+var ch2 = this.$in.readByteAsInt ();
+var ch3 = this.$in.readByteAsInt ();
+var ch4 = this.$in.readByteAsInt ();
+if ((ch1 | ch2 | ch3 | ch4) < 0) throw  new java.io.EOFException ();
+var n = ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
+{
+return (n > 0x7FFFFFFF ? n - 0x100000000 : n);
+}});
+Clazz.overrideMethod (c$, "readLong", 
+function () {
+this.readFully (this.readBuffer, 0, 8);
+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));
+});
+Clazz.overrideMethod (c$, "readFloat", 
+function () {
+return Float.intBitsToFloat (this.readInt ());
+});
+Clazz.overrideMethod (c$, "readDouble", 
+function () {
+return Double.longBitsToDouble (this.readLong ());
+});
+Clazz.overrideMethod (c$, "readLine", 
+function () {
+var buf = this.lineBuffer;
+if (buf == null) {
+buf = this.lineBuffer =  Clazz.newCharArray (128, '\0');
+}var room = buf.length;
+var offset = 0;
+var c;
+loop : while (true) {
+switch (c = this.$in.readByteAsInt ()) {
+case -1:
+case '\n':
+break loop;
+case '\r':
+var c2 = this.$in.readByteAsInt ();
+if ((c2 != 10) && (c2 != -1)) {
+if (!(Clazz.instanceOf (this.$in, java.io.PushbackInputStream))) {
+this.$in =  new java.io.PushbackInputStream (this.$in, 1);
+}(this.$in).unreadByte (c2);
+}break loop;
+default:
+if (--room < 0) {
+buf =  Clazz.newCharArray (offset + 128, '\0');
+room = buf.length - offset - 1;
+System.arraycopy (this.lineBuffer, 0, buf, 0, offset);
+this.lineBuffer = buf;
+}buf[offset++] = String.fromCharCode (c);
+break;
+}
+}
+if ((c == -1) && (offset == 0)) {
+return null;
+}return String.copyValueOf (buf, 0, offset);
+});
+Clazz.overrideMethod (c$, "readUTF", 
+function () {
+return java.io.DataInputStream.readUTFBytes (this, -1);
+});
+c$.readUTFBytes = Clazz.defineMethod (c$, "readUTFBytes", 
+function ($in, utflen) {
+var isByteArray = (utflen >= 0);
+if (!isByteArray) utflen = $in.readUnsignedShort ();
+var bytearr = null;
+var chararr = null;
+if (Clazz.instanceOf ($in, java.io.DataInputStream)) {
+var dis = $in;
+if (dis.bytearr.length < utflen) {
+dis.bytearr =  Clazz.newByteArray (isByteArray ? utflen : utflen * 2, 0);
+dis.chararr =  Clazz.newCharArray (dis.bytearr.length, '\0');
+}chararr = dis.chararr;
+bytearr = dis.bytearr;
+} else {
+bytearr =  Clazz.newByteArray (utflen, 0);
+chararr =  Clazz.newCharArray (utflen, '\0');
+}var c;
+var char2;
+var char3;
+var count = 0;
+var chararr_count = 0;
+$in.readFully (bytearr, 0, utflen);
+while (count < utflen) {
+c = bytearr[count] & 0xff;
+if (c > 127) break;
+count++;
+chararr[chararr_count++] = String.fromCharCode (c);
+}
+while (count < utflen) {
+c = bytearr[count] & 0xff;
+switch (c >> 4) {
+case 0:
+case 1:
+case 2:
+case 3:
+case 4:
+case 5:
+case 6:
+case 7:
+count++;
+chararr[chararr_count++] = String.fromCharCode (c);
+break;
+case 12:
+case 13:
+count += 2;
+if (count > utflen) throw  new java.io.UTFDataFormatException ("malformed input: partial character at end");
+char2 = bytearr[count - 1];
+if ((char2 & 0xC0) != 0x80) throw  new java.io.UTFDataFormatException ("malformed input around byte " + count);
+chararr[chararr_count++] = String.fromCharCode (((c & 0x1F) << 6) | (char2 & 0x3F));
+break;
+case 14:
+count += 3;
+if (count > utflen) throw  new java.io.UTFDataFormatException ("malformed input: partial character at end");
+char2 = bytearr[count - 2];
+char3 = bytearr[count - 1];
+if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) throw  new java.io.UTFDataFormatException ("malformed input around byte " + (count - 1));
+chararr[chararr_count++] = String.fromCharCode (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
+break;
+default:
+throw  new java.io.UTFDataFormatException ("malformed input around byte " + count);
+}
+}
+return  String.instantialize (chararr, 0, chararr_count);
+}, "java.io.DataInput,~N");
+});