1 16 package org.apache.commons.io.output; 17 18 import java.io.IOException ; 19 import java.io.OutputStream ; 20 21 28 public class CountingOutputStream extends ProxyOutputStream { 29 30 private int count; 31 32 36 public CountingOutputStream( OutputStream out ) { 37 super(out); 38 } 39 40 41 public void write(byte[] b) throws IOException { 42 count += b.length; 43 super.write(b); 44 } 45 46 47 public void write(byte[] b, int off, int len) throws IOException { 48 count += len; 49 super.write(b, off, len); 50 } 51 52 53 public void write(int b) throws IOException { 54 count++; 55 super.write(b); 56 } 57 58 62 public int getCount() { 63 return this.count; 64 } 65 66 } 67 | Popular Tags |