X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjava%2Fio%2FInputStream.js;h=94bd8739db2ae2190b9cc2a44c5cccf4807b4204;hp=3bf8cbe885eb29838d7831017f8ba0bc7685e2cf;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6 diff --git a/site/j2s/java/io/InputStream.js b/site/j2s/java/io/InputStream.js index 3bf8cbe..94bd873 100644 --- a/site/j2s/java/io/InputStream.js +++ b/site/j2s/java/io/InputStream.js @@ -1,74 +1,74 @@ -Clazz.load (null, "java.io.InputStream", ["java.io.IOException", "java.lang.IndexOutOfBoundsException", "$.NullPointerException"], function () { -c$ = Clazz.declareType (java.io, "InputStream"); -Clazz.defineMethod (c$, "read", -function (b, off, len) { -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 c = this.readByteAsInt (); -if (c == -1) { -return -1; -}b[off] = c; -var i = 1; -try { -for (; i < len; i++) { -c = this.readByteAsInt (); -if (c == -1) { -break; -}b[off + i] = c; -} -} catch (ee) { -if (Clazz.exceptionOf (ee, java.io.IOException)) { -} else { -throw ee; -} -} -return i; -}, "~A,~N,~N"); -Clazz.defineMethod (c$, "skip", -function (n) { -var remaining = n; -var nr; -if (java.io.InputStream.skipBuffer == null) java.io.InputStream.skipBuffer = Clazz.newByteArray (2048, 0); -var localSkipBuffer = java.io.InputStream.skipBuffer; -if (n <= 0) { -return 0; -}while (remaining > 0) { -nr = this.read (localSkipBuffer, 0, Math.min (2048, remaining)); -if (nr < 0) { -break; -}remaining -= nr; -} -return n - remaining; -}, "~N"); -Clazz.defineMethod (c$, "available", -function () { -return 0; -}); -Clazz.defineMethod (c$, "close", -function () { -}); -Clazz.defineMethod (c$, "mark", -function (readlimit) { -}, "~N"); -Clazz.defineMethod (c$, "reset", -function () { -throw new java.io.IOException ("mark/reset not supported"); -}); -Clazz.defineMethod (c$, "markSupported", -function () { -return false; -}); -Clazz.defineMethod (c$, "resetStream", -function () { -}); -Clazz.defineStatics (c$, -"SKIP_BUFFER_SIZE", 2048, -"skipBuffer", null); -}); +Clazz.load (null, "java.io.InputStream", ["java.io.IOException", "java.lang.IndexOutOfBoundsException", "$.NullPointerException"], function () { +c$ = Clazz.declareType (java.io, "InputStream"); +Clazz.defineMethod (c$, "read", +function (b, off, len) { +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 c = this.readByteAsInt (); +if (c == -1) { +return -1; +}b[off] = c; +var i = 1; +try { +for (; i < len; i++) { +c = this.readByteAsInt (); +if (c == -1) { +break; +}b[off + i] = c; +} +} catch (ee) { +if (Clazz.exceptionOf (ee, java.io.IOException)) { +} else { +throw ee; +} +} +return i; +}, "~A,~N,~N"); +Clazz.defineMethod (c$, "skip", +function (n) { +var remaining = n; +var nr; +if (java.io.InputStream.skipBuffer == null) java.io.InputStream.skipBuffer = Clazz.newByteArray (2048, 0); +var localSkipBuffer = java.io.InputStream.skipBuffer; +if (n <= 0) { +return 0; +}while (remaining > 0) { +nr = this.read (localSkipBuffer, 0, Math.min (2048, remaining)); +if (nr < 0) { +break; +}remaining -= nr; +} +return n - remaining; +}, "~N"); +Clazz.defineMethod (c$, "available", +function () { +return 0; +}); +Clazz.defineMethod (c$, "close", +function () { +}); +Clazz.defineMethod (c$, "mark", +function (readlimit) { +}, "~N"); +Clazz.defineMethod (c$, "reset", +function () { +throw new java.io.IOException ("mark/reset not supported"); +}); +Clazz.defineMethod (c$, "markSupported", +function () { +return false; +}); +Clazz.defineMethod (c$, "resetStream", +function () { +}); +Clazz.defineStatics (c$, +"SKIP_BUFFER_SIZE", 2048, +"skipBuffer", null); +});