Package com.google.common.io
Class CountingOutputStream
- java.lang.Object
 - 
- java.io.OutputStream
 - 
- java.io.FilterOutputStream
 - 
- com.google.common.io.CountingOutputStream
 
 
 
 
- 
- All Implemented Interfaces:
 Closeable,Flushable,AutoCloseable
@GwtIncompatible public final class CountingOutputStream extends FilterOutputStream
An OutputStream that counts the number of bytes written.- Since:
 - 1.0
 - Author:
 - Chris Nokleberg
 
 
- 
- 
Field Summary
- 
Fields inherited from class java.io.FilterOutputStream
out 
 - 
 
- 
Constructor Summary
Constructors Constructor Description CountingOutputStream(OutputStream out)Wraps another output stream, counting the number of bytes written. 
- 
Method Summary
All 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)- 
Methods inherited from class java.io.FilterOutputStream
flush, write 
- 
Methods inherited from class java.io.OutputStream
nullOutputStream 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
CountingOutputStream
public CountingOutputStream(OutputStream out)
Wraps another output stream, counting the number of bytes written.- Parameters:
 out- the output stream to be wrapped
 
 - 
 
- 
Method Detail
- 
getCount
public long getCount()
Returns the number of bytes written. 
- 
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
 writein classFilterOutputStream- Throws:
 IOException
 
- 
write
public void write(int b) throws IOException
- Overrides:
 writein classFilterOutputStream- Throws:
 IOException
 
- 
close
public void close() throws IOException
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable- Overrides:
 closein classFilterOutputStream- Throws:
 IOException
 
 - 
 
 -