4 public class ProgressOutputStream extends FilterOutputStream {
10 public ProgressOutputStream(String title, OutputStream o) { this(title, o, -1); }
12 public ProgressOutputStream(String title, OutputStream o, int size) {
18 public void write(int i) throws IOException {
24 public void write(byte[] b, int off, int len) throws IOException {
25 super.write(b, off, len);
30 private void update() {
31 System.out.print("\r \r");
32 System.out.print(title);
34 int frac = (100 * bytes) / size;
35 String fracs = frac+"";
36 while(fracs.length()<3) fracs = " "+fracs;
37 System.out.print(" ");
38 System.out.print("\033[32m");
39 System.out.print(fracs+"%");
40 System.out.print("\033[0m");
42 System.out.print(" ");
43 System.out.print(bytes);
44 System.out.print(" bytes ");
47 public void close() throws IOException {