1 package hudson.util; 2 3 import java.io.FilterOutputStream ; 4 import java.io.IOException ; 5 import java.io.OutputStream ; 6 7 12 public class CountingOutputStream extends FilterOutputStream { 13 private int count = 0; 14 15 public int getCount() { 16 return count; 17 } 18 19 public CountingOutputStream(OutputStream out) { 20 super(out); 21 } 22 23 public void write(int b) throws IOException { 24 out.write(b); 25 count++; 26 } 27 28 public void write(byte b[]) throws IOException { 29 out.write(b); 30 count += b.length; 31 } 32 33 public void write(byte b[], int off, int len) throws IOException { 34 out.write(b, off, len); 35 count += len; 36 } 37 } 38 | Popular Tags |