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