public class NotifyingOutputStream
extends java.io.OutputStream
Constructor and Description |
---|
NotifyingOutputStream(java.io.OutputStream underlyingOutputStream,
java.util.function.Consumer<java.lang.Long> byteCountListener)
Wraps the
underlyingOutputStream to count the bytes written. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
void |
write(byte[] byteArray) |
void |
write(byte[] byteArray,
int offset,
int length) |
void |
write(int singleByte) |
public NotifyingOutputStream(java.io.OutputStream underlyingOutputStream, java.util.function.Consumer<java.lang.Long> byteCountListener)
underlyingOutputStream
to count the bytes written.underlyingOutputStream
- the wrapped OutputStream
byteCountListener
- the byte count Consumer
public void write(int singleByte) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] byteArray) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] byteArray, int offset, int length) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException