Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / io / PushbackInputStream.js
index bb000a4..55315f3 100644 (file)
-Clazz.load (["java.io.FilterInputStream"], "java.io.PushbackInputStream", ["java.io.IOException", "java.lang.IllegalArgumentException", "$.IndexOutOfBoundsException", "$.NullPointerException"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.buf = null;\r
-this.pos = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, java.io, "PushbackInputStream", java.io.FilterInputStream);\r
-Clazz.defineMethod (c$, "ensureOpen", \r
- function () {\r
-if (this.$in == null) throw  new java.io.IOException ("Stream closed");\r
-});\r
-Clazz.makeConstructor (c$, \r
-function ($in, size) {\r
-Clazz.superConstructor (this, java.io.PushbackInputStream, [$in]);\r
-if (size <= 0) {\r
-throw  new IllegalArgumentException ("size <= 0");\r
-}this.buf =  Clazz.newByteArray (size, 0);\r
-this.pos = size;\r
-}, "java.io.InputStream,~N");\r
-Clazz.overrideMethod (c$, "readByteAsInt", \r
-function () {\r
-this.ensureOpen ();\r
-if (this.pos < this.buf.length) {\r
-return this.buf[this.pos++] & 0xff;\r
-}return this.$in.readByteAsInt ();\r
-});\r
-Clazz.overrideMethod (c$, "read", \r
-function (b, off, len) {\r
-this.ensureOpen ();\r
-if (b == null) {\r
-throw  new NullPointerException ();\r
-} \r
-    if (arguments.length == 1) { off = 0; len = b.length; }\r
-\r
-if (off < 0 || len < 0 || len > b.length - off) {\r
-throw  new IndexOutOfBoundsException ();\r
-} else if (len == 0) {\r
-return 0;\r
-}var avail = this.buf.length - this.pos;\r
-if (avail > 0) {\r
-if (len < avail) {\r
-avail = len;\r
-}System.arraycopy (this.buf, this.pos, b, off, avail);\r
-this.pos += avail;\r
-off += avail;\r
-len -= avail;\r
-}if (len > 0) {\r
-len = this.$in.read (b, off, len);\r
-if (len == -1) {\r
-return avail == 0 ? -1 : avail;\r
-}return avail + len;\r
-}return avail;\r
-}, "~A,~N,~N");\r
-Clazz.defineMethod (c$, "unreadByte", \r
-function (b) {\r
-this.ensureOpen ();\r
-if (this.pos == 0) {\r
-throw  new java.io.IOException ("Push back buffer is full");\r
-}this.buf[--this.pos] = b;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "unread", \r
-function (b, off, len) {\r
-this.ensureOpen ();\r
-if (len > this.pos) {\r
-throw  new java.io.IOException ("Push back buffer is full");\r
-}this.pos -= len;\r
-System.arraycopy (b, off, this.buf, this.pos, len);\r
-}, "~A,~N,~N");\r
-Clazz.overrideMethod (c$, "available", \r
-function () {\r
-this.ensureOpen ();\r
-var n = this.buf.length - this.pos;\r
-var avail = this.$in.available ();\r
-return n > (2147483647 - avail) ? 2147483647 : n + avail;\r
-});\r
-Clazz.overrideMethod (c$, "skip", \r
-function (n) {\r
-this.ensureOpen ();\r
-if (n <= 0) {\r
-return 0;\r
-}var pskip = this.buf.length - this.pos;\r
-if (pskip > 0) {\r
-if (n < pskip) {\r
-pskip = n;\r
-}this.pos += pskip;\r
-n -= pskip;\r
-}if (n > 0) {\r
-pskip += this.$in.skip (n);\r
-}return pskip;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "markSupported", \r
-function () {\r
-return false;\r
-});\r
-Clazz.overrideMethod (c$, "mark", \r
-function (readlimit) {\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "reset", \r
-function () {\r
-throw  new java.io.IOException ("mark/reset not supported");\r
-});\r
-Clazz.overrideMethod (c$, "close", \r
-function () {\r
-if (this.$in == null) return;\r
-this.$in.close ();\r
-this.$in = null;\r
-this.buf = null;\r
-});\r
-});\r
+Clazz.load (["java.io.FilterInputStream"], "java.io.PushbackInputStream", ["java.io.IOException", "java.lang.IllegalArgumentException", "$.IndexOutOfBoundsException", "$.NullPointerException"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.buf = null;
+this.pos = 0;
+Clazz.instantialize (this, arguments);
+}, java.io, "PushbackInputStream", java.io.FilterInputStream);
+Clazz.defineMethod (c$, "ensureOpen", 
+ function () {
+if (this.$in == null) throw  new java.io.IOException ("Stream closed");
+});
+Clazz.makeConstructor (c$, 
+function ($in, size) {
+Clazz.superConstructor (this, java.io.PushbackInputStream, [$in]);
+if (size <= 0) {
+throw  new IllegalArgumentException ("size <= 0");
+}this.buf =  Clazz.newByteArray (size, 0);
+this.pos = size;
+}, "java.io.InputStream,~N");
+Clazz.overrideMethod (c$, "readByteAsInt", 
+function () {
+this.ensureOpen ();
+if (this.pos < this.buf.length) {
+return this.buf[this.pos++] & 0xff;
+}return this.$in.readByteAsInt ();
+});
+Clazz.overrideMethod (c$, "read", 
+function (b, off, len) {
+this.ensureOpen ();
+if (b == null) {
+throw  new NullPointerException ();
+} 
+    if (arguments.length == 1) { off = 0; len = b.length; }
+
+if (off < 0 || len < 0 || len > b.length - off) {
+throw  new IndexOutOfBoundsException ();
+} else if (len == 0) {
+return 0;
+}var avail = this.buf.length - this.pos;
+if (avail > 0) {
+if (len < avail) {
+avail = len;
+}System.arraycopy (this.buf, this.pos, b, off, avail);
+this.pos += avail;
+off += avail;
+len -= avail;
+}if (len > 0) {
+len = this.$in.read (b, off, len);
+if (len == -1) {
+return avail == 0 ? -1 : avail;
+}return avail + len;
+}return avail;
+}, "~A,~N,~N");
+Clazz.defineMethod (c$, "unreadByte", 
+function (b) {
+this.ensureOpen ();
+if (this.pos == 0) {
+throw  new java.io.IOException ("Push back buffer is full");
+}this.buf[--this.pos] = b;
+}, "~N");
+Clazz.defineMethod (c$, "unread", 
+function (b, off, len) {
+this.ensureOpen ();
+if (len > this.pos) {
+throw  new java.io.IOException ("Push back buffer is full");
+}this.pos -= len;
+System.arraycopy (b, off, this.buf, this.pos, len);
+}, "~A,~N,~N");
+Clazz.overrideMethod (c$, "available", 
+function () {
+this.ensureOpen ();
+var n = this.buf.length - this.pos;
+var avail = this.$in.available ();
+return n > (2147483647 - avail) ? 2147483647 : n + avail;
+});
+Clazz.overrideMethod (c$, "skip", 
+function (n) {
+this.ensureOpen ();
+if (n <= 0) {
+return 0;
+}var pskip = this.buf.length - this.pos;
+if (pskip > 0) {
+if (n < pskip) {
+pskip = n;
+}this.pos += pskip;
+n -= pskip;
+}if (n > 0) {
+pskip += this.$in.skip (n);
+}return pskip;
+}, "~N");
+Clazz.overrideMethod (c$, "markSupported", 
+function () {
+return false;
+});
+Clazz.overrideMethod (c$, "mark", 
+function (readlimit) {
+}, "~N");
+Clazz.overrideMethod (c$, "reset", 
+function () {
+throw  new java.io.IOException ("mark/reset not supported");
+});
+Clazz.overrideMethod (c$, "close", 
+function () {
+if (this.$in == null) return;
+this.$in.close ();
+this.$in = null;
+this.buf = null;
+});
+});