Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / io / Reader.js
1 Clazz.load (["java.io.Closeable"], "java.io.Reader", ["java.io.IOException", "java.lang.IllegalArgumentException", "$.NullPointerException"], function () {
2 c$ = Clazz.decorateAsClass (function () {
3 this.lock = null;
4 this.skipBuffer = null;
5 Clazz.instantialize (this, arguments);
6 }, java.io, "Reader", null, java.io.Closeable);
7 Clazz.makeConstructor (c$, 
8 function (lock) {
9 if (lock == null) {
10 throw  new NullPointerException ();
11 }this.lock = lock;
12 }, "~O");
13 Clazz.defineMethod (c$, "skip", 
14 function (n) {
15 if (n < 0) throw  new IllegalArgumentException ("skip value is negative");
16 var nn = Math.min (n, 8192);
17 {
18 if ((this.skipBuffer == null) || (this.skipBuffer.length < nn)) this.skipBuffer =  Clazz.newCharArray (nn, '\0');
19 var r = n;
20 while (r > 0) {
21 var nc = this.read (this.skipBuffer, 0, Math.min (r, nn));
22 if (nc == -1) break;
23 r -= nc;
24 }
25 return n - r;
26 }}, "~N");
27 Clazz.defineMethod (c$, "ready", 
28 function () {
29 return false;
30 });
31 Clazz.defineMethod (c$, "markSupported", 
32 function () {
33 return false;
34 });
35 Clazz.defineMethod (c$, "mark", 
36 function (readAheadLimit) {
37 throw  new java.io.IOException ("mark() not supported");
38 }, "~N");
39 Clazz.defineMethod (c$, "reset", 
40 function () {
41 throw  new java.io.IOException ("reset() not supported");
42 });
43 Clazz.defineStatics (c$,
44 "MAX_SKIP_BUFFE_SIZE", 8192);
45 });