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