Package org.apache.commons.vfs2.util
Class MonitorOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.BufferedOutputStream
org.apache.commons.vfs2.util.MonitorOutputStream
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable
An OutputStream that provides buffering and end-of-stream monitoring.
- 
Field SummaryFields inherited from class java.io.BufferedOutputStreambuf, countFields inherited from class java.io.FilterOutputStreamout
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a MonitorOutputStream from the passed OutputStream.MonitorOutputStream(OutputStream out, int bufferSize) Constructs a MonitorOutputStream from the passed OutputStream and with the specified buffer size.
- 
Method Summary
- 
Constructor Details- 
MonitorOutputStreamConstructs a MonitorOutputStream from the passed OutputStream.- Parameters:
- out- The output stream to wrap.
 
- 
MonitorOutputStreamConstructs a MonitorOutputStream from the passed OutputStream and with the specified buffer size.- Parameters:
- out- The output stream to wrap.
- bufferSize- The buffer size to use.
- Since:
- 2.4
 
 
- 
- 
Method Details- 
assertOpenCheck if file is still open.This is a workaround for an oddity with Java's BufferedOutputStream where you can write to even if the stream has been closed. - Throws:
- FileSystemException- if already closed.
- Since:
- 2.0
 
- 
closeCloses this output stream.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. - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- FilterOutputStream
- Throws:
- IOException- if an IO error occurs.
 
- 
flush- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- BufferedOutputStream
- Throws:
- IOException- if an error occurs.
- Since:
- 2.0
 
- 
onCloseCalled after this stream is closed.This implementation does nothing. - Throws:
- IOException- if an error occurs.
 
- 
write- Overrides:
- writein class- FilterOutputStream
- Parameters:
- b- The byte array.
- Throws:
- IOException- if an error occurs.
- Since:
- 2.0
 
- 
write- Overrides:
- writein class- BufferedOutputStream
- Parameters:
- b- The byte array.
- off- The offset into the array.
- len- The number of bytes to write.
- Throws:
- IOException- if an error occurs.
- Since:
- 2.0
 
- 
write- Overrides:
- writein class- BufferedOutputStream
- Parameters:
- b- The character to write.
- Throws:
- IOException- if an error occurs.
- Since:
- 2.0
 
 
-