JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / io / SequenceInputStream.js
1 \feffClazz.load (["java.io.InputStream"], "java.io.SequenceInputStream", ["java.lang.Error", "$.IndexOutOfBoundsException", "$.NullPointerException", "java.util.Vector"], function () {\r
2 c$ = Clazz.decorateAsClass (function () {\r
3 this.e = null;\r
4 this.$in = null;\r
5 Clazz.instantialize (this, arguments);\r
6 }, java.io, "SequenceInputStream", java.io.InputStream);\r
7 Clazz.makeConstructor (c$, \r
8 function (e) {\r
9 Clazz.superConstructor (this, java.io.SequenceInputStream, []);\r
10 this.e = e;\r
11 try {\r
12 this.nextStream ();\r
13 } catch (ex) {\r
14 if (Clazz.exceptionOf (ex, java.io.IOException)) {\r
15 throw  new Error ("panic");\r
16 } else {\r
17 throw ex;\r
18 }\r
19 }\r
20 }, "java.util.Enumeration");\r
21 Clazz.makeConstructor (c$, \r
22 function (s1, s2) {\r
23 Clazz.superConstructor (this, java.io.SequenceInputStream, []);\r
24 var v =  new java.util.Vector (2);\r
25 v.addElement (s1);\r
26 v.addElement (s2);\r
27 this.e = v.elements ();\r
28 try {\r
29 this.nextStream ();\r
30 } catch (ex) {\r
31 if (Clazz.exceptionOf (ex, java.io.IOException)) {\r
32 throw  new Error ("panic");\r
33 } else {\r
34 throw ex;\r
35 }\r
36 }\r
37 }, "java.io.InputStream,java.io.InputStream");\r
38 Clazz.defineMethod (c$, "nextStream", \r
39 function () {\r
40 if (this.$in != null) {\r
41 this.$in.close ();\r
42 }if (this.e.hasMoreElements ()) {\r
43 this.$in = this.e.nextElement ();\r
44 if (this.$in == null) throw  new NullPointerException ();\r
45 } else this.$in = null;\r
46 });\r
47 Clazz.defineMethod (c$, "available", \r
48 function () {\r
49 if (this.$in == null) {\r
50 return 0;\r
51 }return this.$in.available ();\r
52 });\r
53 Clazz.defineMethod (c$, "readByteAsInt", \r
54 function () {\r
55 if (this.$in == null) {\r
56 return -1;\r
57 }var c = this.$in.readByteAsInt ();\r
58 if (c == -1) {\r
59 this.nextStream ();\r
60 return this.readByteAsInt ();\r
61 }return c;\r
62 });\r
63 Clazz.defineMethod (c$, "read", \r
64 function (b, off, len) {\r
65 if (this.$in == null) {\r
66 return -1;\r
67 } else if (b == null) {\r
68 throw  new NullPointerException ();\r
69 } else if (off < 0 || len < 0 || len > b.length - off) {\r
70 throw  new IndexOutOfBoundsException ();\r
71 } else if (len == 0) {\r
72 return 0;\r
73 }var n = this.$in.read (b, off, len);\r
74 if (n <= 0) {\r
75 this.nextStream ();\r
76 return this.read (b, off, len);\r
77 }return n;\r
78 }, "~A,~N,~N");\r
79 Clazz.defineMethod (c$, "close", \r
80 function () {\r
81 do {\r
82 this.nextStream ();\r
83 } while (this.$in != null);\r
84 });\r
85 });\r