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