CountingOutputStream.java revision 8978aac1977408b05e386ae846c30920c7faa0a6
1package com.android.email.mail.transport; 2 3import java.io.IOException; 4import java.io.OutputStream; 5 6/** 7 * A simple OutputStream that does nothing but count how many bytes are written to it and 8 * makes that count available to callers. 9 */ 10public class CountingOutputStream extends OutputStream { 11 private long mCount; 12 13 public CountingOutputStream() { 14 } 15 16 public long getCount() { 17 return mCount; 18 } 19 20 @Override 21 public void write(int oneByte) throws IOException { 22 mCount++; 23 } 24} 25