public class MonitorOutputStream extends BufferedOutputStream
buf, countout| Constructor and Description |
|---|
MonitorOutputStream(OutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertOpen()
Check if file is still open.
|
void |
close()
Closes this output stream.
|
void |
flush() |
protected void |
onClose()
Called after this stream is closed.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public MonitorOutputStream(OutputStream out)
public void close()
throws IOException
This makes sure the buffers are flushed, close the output
stream and it will call onClose()
and re-throw last exception from any of the three.
This does nothing if the stream is closed already.
close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOException - if an error occurs.public void write(int b)
throws IOException
write in class BufferedOutputStreamb - The character to write.IOException - if an error occurs.public void write(byte[] b,
int off,
int len)
throws IOException
write in class BufferedOutputStreamb - The byte array.off - The offset into the array.len - The number of bytes to write.IOException - if an error occurs.public void flush()
throws IOException
flush in interface Flushableflush in class BufferedOutputStreamIOException - if an error occurs.public void write(byte[] b)
throws IOException
write in class FilterOutputStreamb - The byte array.IOException - if an error occurs.protected void assertOpen()
throws FileSystemException
This is a workaround for an oddity with Java's BufferedOutputStream where you can write to even if the stream has been closed.
FileSystemException - if already closed.protected void onClose()
throws IOException
This implementation does nothing.
IOException - if an error occurs.Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.