com.planetj.servlet.filter.compression
Class StatsOutputStream
java.lang.Object
java.io.OutputStream
com.planetj.servlet.filter.compression.StatsOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
final class StatsOutputStream
- extends java.io.OutputStream
An OutputStream
that decorates another OutputStream
and notes when bytes are written to the stream.
Callers create an instance of StatsOutputStream
with an instance of StatsOutputStream.StatsCallback
, which receives
notification of writes. This information might be used to tally the number of bytes written to a stream.
- Author:
- Sean Owen
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
outputStream
private final java.io.OutputStream outputStream
statsCallback
private final StatsOutputStream.StatsCallback statsCallback
StatsOutputStream
StatsOutputStream(java.io.OutputStream outputStream,
StatsOutputStream.StatsCallback statsCallback)
write
public void write(int b)
throws java.io.IOException
- Specified by:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Overrides:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush
in interface java.io.Flushable
- Overrides:
flush
in class java.io.OutputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.OutputStream
- Throws:
java.io.IOException
toString
@NotNull
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object