Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / io / FilterOutputStream.js
1 Clazz.load (["java.io.OutputStream"], "java.io.FilterOutputStream", ["java.lang.IndexOutOfBoundsException"], function () {
2 c$ = Clazz.decorateAsClass (function () {
3 this.out = null;
4 Clazz.instantialize (this, arguments);
5 }, java.io, "FilterOutputStream", java.io.OutputStream);
6 Clazz.defineMethod (c$, "jzSetFOS", 
7 function (out) {
8 this.out = out;
9 }, "java.io.OutputStream");
10 Clazz.defineMethod (c$, "writeByteAsInt", 
11 function (b) {
12 this.out.writeByteAsInt (b);
13 }, "~N");
14 Clazz.defineMethod (c$, "write", 
15 function (b, off, len) {
16 if ((off | len | (b.length - (len + off)) | (off + len)) < 0) throw  new IndexOutOfBoundsException ();
17 for (var i = 0; i < len; i++) {
18 this.writeByteAsInt (b[off + i]);
19 }
20 }, "~A,~N,~N");
21 Clazz.defineMethod (c$, "flush", 
22 function () {
23 this.out.flush ();
24 });
25 Clazz.defineMethod (c$, "close", 
26 function () {
27 try {
28 this.flush ();
29 } catch (ignored) {
30 if (Clazz.exceptionOf (ignored, java.io.IOException)) {
31 } else {
32 throw ignored;
33 }
34 }
35 this.out.close ();
36 });
37 });