Package com.google.common.io
Class CountingOutputStream
- java.lang.Object
- 
- java.io.OutputStream
- 
- java.io.FilterOutputStream
- 
- com.google.common.io.CountingOutputStream
 
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.io.Flushable,- java.lang.AutoCloseable
 
 @GwtIncompatible public final class CountingOutputStream extends java.io.FilterOutputStream An OutputStream that counts the number of bytes written.- Since:
- 1.0
- Author:
- Chris Nokleberg
 
- 
- 
Constructor SummaryConstructors Constructor Description CountingOutputStream(java.io.OutputStream out)Wraps another output stream, counting the number of bytes written.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longgetCount()Returns the number of bytes written.voidwrite(byte[] b, int off, int len)voidwrite(int b)
 
- 
- 
- 
Constructor Detail- 
CountingOutputStreampublic CountingOutputStream(java.io.OutputStream out) Wraps another output stream, counting the number of bytes written.- Parameters:
- out- the output stream to be wrapped
 
 
- 
 - 
Method Detail- 
getCountpublic long getCount() Returns the number of bytes written.
 - 
writepublic void write(byte[] b, int off, int len) throws java.io.IOException - Overrides:
- writein class- java.io.FilterOutputStream
- Throws:
- java.io.IOException
 
 - 
writepublic void write(int b) throws java.io.IOException - Overrides:
- writein class- java.io.FilterOutputStream
- Throws:
- java.io.IOException
 
 - 
closepublic void close() throws java.io.IOException - Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Overrides:
- closein class- java.io.FilterOutputStream
- Throws:
- java.io.IOException
 
 
- 
 
-