Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / JU / BinaryDocument.js
index 72144d3..b59f53c 100644 (file)
-Clazz.declarePackage ("JU");\r
-Clazz.load (["javajs.api.GenericBinaryDocument", "JU.BC"], "JU.BinaryDocument", ["java.io.DataInputStream", "java.lang.Double"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.stream = null;\r
-this.isRandom = false;\r
-this.isBigEndian = true;\r
-this.jzt = null;\r
-this.t8 = null;\r
-this.nBytes = 0;\r
-this.out = null;\r
-Clazz.instantialize (this, arguments);\r
-}, JU, "BinaryDocument", JU.BC, javajs.api.GenericBinaryDocument);\r
-Clazz.prepareFields (c$, function () {\r
-this.t8 =  Clazz.newByteArray (8, 0);\r
-});\r
-Clazz.overrideMethod (c$, "close", \r
-function () {\r
-if (this.stream != null) try {\r
-this.stream.close ();\r
-} catch (e) {\r
-if (Clazz.exceptionOf (e, Exception)) {\r
-} else {\r
-throw e;\r
-}\r
-}\r
-if (this.out != null) this.out.closeChannel ();\r
-});\r
-Clazz.overrideMethod (c$, "setStream", \r
-function (jzt, bis, isBigEndian) {\r
-if (jzt != null) this.jzt = jzt;\r
-if (bis != null) this.stream =  new java.io.DataInputStream (bis);\r
-this.isBigEndian = isBigEndian;\r
-}, "javajs.api.GenericZipTools,java.io.BufferedInputStream,~B");\r
-Clazz.overrideMethod (c$, "setStreamData", \r
-function (stream, isBigEndian) {\r
-if (stream != null) this.stream = stream;\r
-this.isBigEndian = isBigEndian;\r
-}, "java.io.DataInputStream,~B");\r
-Clazz.defineMethod (c$, "setRandom", \r
-function (TF) {\r
-this.isRandom = TF;\r
-}, "~B");\r
-Clazz.overrideMethod (c$, "readByte", \r
-function () {\r
-this.nBytes++;\r
-return this.ioReadByte ();\r
-});\r
-Clazz.defineMethod (c$, "ioReadByte", \r
- function () {\r
-var b = this.stream.readByte ();\r
-if (this.out != null) this.out.writeByteAsInt (b);\r
-return b;\r
-});\r
-Clazz.overrideMethod (c$, "readByteArray", \r
-function (b, off, len) {\r
-var n = this.ioRead (b, off, len);\r
-this.nBytes += n;\r
-return n;\r
-}, "~A,~N,~N");\r
-Clazz.defineMethod (c$, "ioRead", \r
- function (b, off, len) {\r
-var m = 0;\r
-while (len > 0) {\r
-var n = this.stream.read (b, off, len);\r
-m += n;\r
-if (n > 0 && this.out != null) this.writeBytes (b, off, n);\r
-if (n >= len) break;\r
-off += n;\r
-len -= n;\r
-}\r
-return m;\r
-}, "~A,~N,~N");\r
-Clazz.defineMethod (c$, "writeBytes", \r
-function (b, off, n) {\r
-this.out.write (b, off, n);\r
-}, "~A,~N,~N");\r
-Clazz.overrideMethod (c$, "readString", \r
-function (nChar) {\r
-var temp =  Clazz.newByteArray (nChar, 0);\r
-var n = this.readByteArray (temp, 0, nChar);\r
-return  String.instantialize (temp, 0, n, "UTF-8");\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "readShort", \r
-function () {\r
-this.nBytes += 2;\r
-var n = (this.isBigEndian ? this.ioReadShort () : ((this.ioReadByte () & 0xff) | (this.ioReadByte () & 0xff) << 8));\r
-{\r
-return (n > 0x7FFF ? n - 0x10000 : n);\r
-}});\r
-Clazz.defineMethod (c$, "ioReadShort", \r
- function () {\r
-var b = this.stream.readShort ();\r
-if (this.out != null) this.writeShort (b);\r
-return b;\r
-});\r
-Clazz.defineMethod (c$, "writeShort", \r
-function (i) {\r
-this.out.writeByteAsInt (i >> 8);\r
-this.out.writeByteAsInt (i);\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "readIntLE", \r
-function () {\r
-this.nBytes += 4;\r
-return this.readLEInt ();\r
-});\r
-Clazz.overrideMethod (c$, "readInt", \r
-function () {\r
-this.nBytes += 4;\r
-return (this.isBigEndian ? this.ioReadInt () : this.readLEInt ());\r
-});\r
-Clazz.defineMethod (c$, "ioReadInt", \r
- function () {\r
-var i = this.stream.readInt ();\r
-if (this.out != null) this.writeInt (i);\r
-return i;\r
-});\r
-Clazz.defineMethod (c$, "writeInt", \r
-function (i) {\r
-this.out.writeByteAsInt (i >> 24);\r
-this.out.writeByteAsInt (i >> 16);\r
-this.out.writeByteAsInt (i >> 8);\r
-this.out.writeByteAsInt (i);\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "swapBytesI", \r
-function (n) {\r
-return (((n >> 24) & 0xff) | ((n >> 16) & 0xff) << 8 | ((n >> 8) & 0xff) << 16 | (n & 0xff) << 24);\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "swapBytesS", \r
-function (n) {\r
-return ((((n >> 8) & 0xff) | (n & 0xff) << 8));\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "readUnsignedShort", \r
-function () {\r
-this.nBytes += 2;\r
-var a = (this.ioReadByte () & 0xff);\r
-var b = (this.ioReadByte () & 0xff);\r
-return (this.isBigEndian ? (a << 8) + b : (b << 8) + a);\r
-});\r
-Clazz.overrideMethod (c$, "readLong", \r
-function () {\r
-this.nBytes += 8;\r
-return (this.isBigEndian ? this.ioReadLong () : (((this.ioReadByte ()) & 0xff) | ((this.ioReadByte ()) & 0xff) << 8 | ((this.ioReadByte ()) & 0xff) << 16 | ((this.ioReadByte ()) & 0xff) << 24 | ((this.ioReadByte ()) & 0xff) << 32 | ((this.ioReadByte ()) & 0xff) << 40 | ((this.ioReadByte ()) & 0xff) << 48 | ((this.ioReadByte ()) & 0xff) << 54));\r
-});\r
-Clazz.defineMethod (c$, "ioReadLong", \r
- function () {\r
-var b = this.stream.readLong ();\r
-if (this.out != null) this.writeLong (b);\r
-return b;\r
-});\r
-Clazz.defineMethod (c$, "writeLong", \r
-function (b) {\r
-this.writeInt (((b >> 32) & 0xFFFFFFFF));\r
-this.writeInt ((b & 0xFFFFFFFF));\r
-}, "~N");\r
-Clazz.defineMethod (c$, "readLEInt", \r
- function () {\r
-this.ioRead (this.t8, 0, 4);\r
-return JU.BC.bytesToInt (this.t8, 0, false);\r
-});\r
-Clazz.overrideMethod (c$, "readFloat", \r
-function () {\r
-return JU.BC.intToFloat (this.readInt ());\r
-});\r
-Clazz.overrideMethod (c$, "readDouble", \r
-function () {\r
-{\r
-this.readByteArray(this.t8, 0, 8);\r
-return this.bytesToDoubleToFloat(this.t8, 0, this.isBigEndian);\r
-}});\r
-Clazz.defineMethod (c$, "ioReadDouble", \r
- function () {\r
-var d = this.stream.readDouble ();\r
-if (this.out != null) this.writeLong (Double.doubleToRawLongBits (d));\r
-return d;\r
-});\r
-Clazz.defineMethod (c$, "readLELong", \r
- function () {\r
-return (((this.ioReadByte ()) & 0xff) | ((this.ioReadByte ()) & 0xff) << 8 | ((this.ioReadByte ()) & 0xff) << 16 | ((this.ioReadByte ()) & 0xff) << 24 | ((this.ioReadByte ()) & 0xff) << 32 | ((this.ioReadByte ()) & 0xff) << 40 | ((this.ioReadByte ()) & 0xff) << 48 | ((this.ioReadByte ()) & 0xff) << 56);\r
-});\r
-Clazz.overrideMethod (c$, "seek", \r
-function (offset) {\r
-try {\r
-if (offset == this.nBytes) return;\r
-if (offset < this.nBytes) {\r
-this.stream.reset ();\r
-if (this.out != null && this.nBytes != 0) this.out.reset ();\r
-this.nBytes = 0;\r
-} else {\r
-offset -= this.nBytes;\r
-}if (this.out == null) {\r
-this.stream.skipBytes (offset);\r
-} else {\r
-this.readByteArray ( Clazz.newByteArray (offset, 0), 0, offset);\r
-}this.nBytes += offset;\r
-} catch (e) {\r
-if (Clazz.exceptionOf (e, Exception)) {\r
-System.out.println (e.toString ());\r
-} else {\r
-throw e;\r
-}\r
-}\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "getPosition", \r
-function () {\r
-return this.nBytes;\r
-});\r
-Clazz.overrideMethod (c$, "setOutputChannel", \r
-function (out) {\r
-this.out = out;\r
-}, "JU.OC");\r
-Clazz.overrideMethod (c$, "getAllDataFiles", \r
-function (binaryFileList, firstFile) {\r
-return null;\r
-}, "~S,~S");\r
-Clazz.overrideMethod (c$, "getAllDataMapped", \r
-function (replace, string, fileData) {\r
-}, "~S,~S,java.util.Map");\r
-});\r
+Clazz.declarePackage ("JU");
+Clazz.load (["javajs.api.GenericBinaryDocument", "JU.BC"], "JU.BinaryDocument", ["java.io.DataInputStream", "java.lang.Double"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.stream = null;
+this.isRandom = false;
+this.isBigEndian = true;
+this.jzt = null;
+this.t8 = null;
+this.nBytes = 0;
+this.out = null;
+Clazz.instantialize (this, arguments);
+}, JU, "BinaryDocument", JU.BC, javajs.api.GenericBinaryDocument);
+Clazz.prepareFields (c$, function () {
+this.t8 =  Clazz.newByteArray (8, 0);
+});
+Clazz.overrideMethod (c$, "close", 
+function () {
+if (this.stream != null) try {
+this.stream.close ();
+} catch (e) {
+if (Clazz.exceptionOf (e, Exception)) {
+} else {
+throw e;
+}
+}
+if (this.out != null) this.out.closeChannel ();
+});
+Clazz.overrideMethod (c$, "setStream", 
+function (jzt, bis, isBigEndian) {
+if (jzt != null) this.jzt = jzt;
+if (bis != null) this.stream =  new java.io.DataInputStream (bis);
+this.isBigEndian = isBigEndian;
+}, "javajs.api.GenericZipTools,java.io.BufferedInputStream,~B");
+Clazz.overrideMethod (c$, "setStreamData", 
+function (stream, isBigEndian) {
+if (stream != null) this.stream = stream;
+this.isBigEndian = isBigEndian;
+}, "java.io.DataInputStream,~B");
+Clazz.defineMethod (c$, "setRandom", 
+function (TF) {
+this.isRandom = TF;
+}, "~B");
+Clazz.overrideMethod (c$, "readByte", 
+function () {
+this.nBytes++;
+return this.ioReadByte ();
+});
+Clazz.defineMethod (c$, "ioReadByte", 
+ function () {
+var b = this.stream.readByte ();
+if (this.out != null) this.out.writeByteAsInt (b);
+return b;
+});
+Clazz.overrideMethod (c$, "readByteArray", 
+function (b, off, len) {
+var n = this.ioRead (b, off, len);
+this.nBytes += n;
+return n;
+}, "~A,~N,~N");
+Clazz.defineMethod (c$, "ioRead", 
+ function (b, off, len) {
+var m = 0;
+while (len > 0) {
+var n = this.stream.read (b, off, len);
+m += n;
+if (n > 0 && this.out != null) this.writeBytes (b, off, n);
+if (n >= len) break;
+off += n;
+len -= n;
+}
+return m;
+}, "~A,~N,~N");
+Clazz.defineMethod (c$, "writeBytes", 
+function (b, off, n) {
+this.out.write (b, off, n);
+}, "~A,~N,~N");
+Clazz.overrideMethod (c$, "readString", 
+function (nChar) {
+var temp =  Clazz.newByteArray (nChar, 0);
+var n = this.readByteArray (temp, 0, nChar);
+return  String.instantialize (temp, 0, n, "UTF-8");
+}, "~N");
+Clazz.overrideMethod (c$, "readShort", 
+function () {
+this.nBytes += 2;
+var n = (this.isBigEndian ? this.ioReadShort () : ((this.ioReadByte () & 0xff) | (this.ioReadByte () & 0xff) << 8));
+{
+return (n > 0x7FFF ? n - 0x10000 : n);
+}});
+Clazz.defineMethod (c$, "ioReadShort", 
+ function () {
+var b = this.stream.readShort ();
+if (this.out != null) this.writeShort (b);
+return b;
+});
+Clazz.defineMethod (c$, "writeShort", 
+function (i) {
+this.out.writeByteAsInt (i >> 8);
+this.out.writeByteAsInt (i);
+}, "~N");
+Clazz.overrideMethod (c$, "readIntLE", 
+function () {
+this.nBytes += 4;
+return this.readLEInt ();
+});
+Clazz.overrideMethod (c$, "readInt", 
+function () {
+this.nBytes += 4;
+return (this.isBigEndian ? this.ioReadInt () : this.readLEInt ());
+});
+Clazz.defineMethod (c$, "ioReadInt", 
+ function () {
+var i = this.stream.readInt ();
+if (this.out != null) this.writeInt (i);
+return i;
+});
+Clazz.defineMethod (c$, "writeInt", 
+function (i) {
+this.out.writeByteAsInt (i >> 24);
+this.out.writeByteAsInt (i >> 16);
+this.out.writeByteAsInt (i >> 8);
+this.out.writeByteAsInt (i);
+}, "~N");
+Clazz.overrideMethod (c$, "swapBytesI", 
+function (n) {
+return (((n >> 24) & 0xff) | ((n >> 16) & 0xff) << 8 | ((n >> 8) & 0xff) << 16 | (n & 0xff) << 24);
+}, "~N");
+Clazz.overrideMethod (c$, "swapBytesS", 
+function (n) {
+return ((((n >> 8) & 0xff) | (n & 0xff) << 8));
+}, "~N");
+Clazz.overrideMethod (c$, "readUnsignedShort", 
+function () {
+this.nBytes += 2;
+var a = (this.ioReadByte () & 0xff);
+var b = (this.ioReadByte () & 0xff);
+return (this.isBigEndian ? (a << 8) + b : (b << 8) + a);
+});
+Clazz.overrideMethod (c$, "readLong", 
+function () {
+this.nBytes += 8;
+return (this.isBigEndian ? this.ioReadLong () : (((this.ioReadByte ()) & 0xff) | ((this.ioReadByte ()) & 0xff) << 8 | ((this.ioReadByte ()) & 0xff) << 16 | ((this.ioReadByte ()) & 0xff) << 24 | ((this.ioReadByte ()) & 0xff) << 32 | ((this.ioReadByte ()) & 0xff) << 40 | ((this.ioReadByte ()) & 0xff) << 48 | ((this.ioReadByte ()) & 0xff) << 54));
+});
+Clazz.defineMethod (c$, "ioReadLong", 
+ function () {
+var b = this.stream.readLong ();
+if (this.out != null) this.writeLong (b);
+return b;
+});
+Clazz.defineMethod (c$, "writeLong", 
+function (b) {
+this.writeInt (((b >> 32) & 0xFFFFFFFF));
+this.writeInt ((b & 0xFFFFFFFF));
+}, "~N");
+Clazz.defineMethod (c$, "readLEInt", 
+ function () {
+this.ioRead (this.t8, 0, 4);
+return JU.BC.bytesToInt (this.t8, 0, false);
+});
+Clazz.overrideMethod (c$, "readFloat", 
+function () {
+return JU.BC.intToFloat (this.readInt ());
+});
+Clazz.overrideMethod (c$, "readDouble", 
+function () {
+{
+this.readByteArray(this.t8, 0, 8);
+return this.bytesToDoubleToFloat(this.t8, 0, this.isBigEndian);
+}});
+Clazz.defineMethod (c$, "ioReadDouble", 
+ function () {
+var d = this.stream.readDouble ();
+if (this.out != null) this.writeLong (Double.doubleToRawLongBits (d));
+return d;
+});
+Clazz.defineMethod (c$, "readLELong", 
+ function () {
+return (((this.ioReadByte ()) & 0xff) | ((this.ioReadByte ()) & 0xff) << 8 | ((this.ioReadByte ()) & 0xff) << 16 | ((this.ioReadByte ()) & 0xff) << 24 | ((this.ioReadByte ()) & 0xff) << 32 | ((this.ioReadByte ()) & 0xff) << 40 | ((this.ioReadByte ()) & 0xff) << 48 | ((this.ioReadByte ()) & 0xff) << 56);
+});
+Clazz.overrideMethod (c$, "seek", 
+function (offset) {
+try {
+if (offset == this.nBytes) return;
+if (offset < this.nBytes) {
+this.stream.reset ();
+if (this.out != null && this.nBytes != 0) this.out.reset ();
+this.nBytes = 0;
+} else {
+offset -= this.nBytes;
+}if (this.out == null) {
+this.stream.skipBytes (offset);
+} else {
+this.readByteArray ( Clazz.newByteArray (offset, 0), 0, offset);
+}this.nBytes += offset;
+} catch (e) {
+if (Clazz.exceptionOf (e, Exception)) {
+System.out.println (e.toString ());
+} else {
+throw e;
+}
+}
+}, "~N");
+Clazz.overrideMethod (c$, "getPosition", 
+function () {
+return this.nBytes;
+});
+Clazz.overrideMethod (c$, "setOutputChannel", 
+function (out) {
+this.out = out;
+}, "JU.OC");
+Clazz.overrideMethod (c$, "getAllDataFiles", 
+function (binaryFileList, firstFile) {
+return null;
+}, "~S,~S");
+Clazz.overrideMethod (c$, "getAllDataMapped", 
+function (replace, string, fileData) {
+}, "~S,~S,java.util.Map");
+});