1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["java.io.FilterInputStream"], "javax.swing.ProgressMonitorInputStream", ["java.io.InterruptedIOException", "javax.swing.ProgressMonitor"], function () {
3 c$ = Clazz.decorateAsClass (function () {
7 Clazz.instantialize (this, arguments);
8 }, javax.swing, "ProgressMonitorInputStream", java.io.FilterInputStream);
9 Clazz.makeConstructor (c$,
10 function (parentComponent, message, $in) {
11 Clazz.superConstructor (this, javax.swing.ProgressMonitorInputStream, [$in]);
13 this.size = $in.available ();
15 if (Clazz.exceptionOf (ioe, java.io.IOException)) {
21 this.monitor = new javax.swing.ProgressMonitor (parentComponent, message, null, 0, this.size);
22 }, "java.awt.Component,~O,java.io.InputStream");
23 Clazz.defineMethod (c$, "getProgressMonitor",
27 Clazz.defineMethod (c$, "read",
29 var c = this.$in.read ();
30 if (c >= 0) this.monitor.setProgress (++this.nread);
31 if (this.monitor.isCanceled ()) {
32 var exc = new java.io.InterruptedIOException ("progress");
33 exc.bytesTransferred = this.nread;
37 Clazz.defineMethod (c$, "read",
39 var nr = this.$in.read (b);
40 if (nr > 0) this.monitor.setProgress (this.nread += nr);
41 if (this.monitor.isCanceled ()) {
42 var exc = new java.io.InterruptedIOException ("progress");
43 exc.bytesTransferred = this.nread;
47 Clazz.defineMethod (c$, "read",
48 function (b, off, len) {
49 var nr = this.$in.read (b, off, len);
50 if (nr > 0) this.monitor.setProgress (this.nread += nr);
51 if (this.monitor.isCanceled ()) {
52 var exc = new java.io.InterruptedIOException ("progress");
53 exc.bytesTransferred = this.nread;
57 Clazz.overrideMethod (c$, "skip",
59 var nr = this.$in.skip (n);
60 if (nr > 0) this.monitor.setProgress (this.nread += nr);
63 Clazz.overrideMethod (c$, "close",
66 this.monitor.close ();
68 Clazz.overrideMethod (c$, "reset",
71 this.nread = this.size - this.$in.available ();
72 this.monitor.setProgress (this.nread);