X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjava%2Fio%2FPushbackInputStream.js;h=55315f3c3a6798cee0e085e6f122604b97762bab;hp=bb000a4ffe54980067cccbf36300b2e0e956e1a2;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6 diff --git a/site/j2s/java/io/PushbackInputStream.js b/site/j2s/java/io/PushbackInputStream.js index bb000a4..55315f3 100644 --- a/site/j2s/java/io/PushbackInputStream.js +++ b/site/j2s/java/io/PushbackInputStream.js @@ -1,108 +1,108 @@ -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; -}); -}); +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; +}); +});