public class OutputStreamWrapper extends Object implements Closeable
OutputStream
instance. This wrapper is intended to wrap OutputStream
instances for use with CloseableRegistry, hence such
instances should not be closed directly, that is, without going
through the wrapper's close() method.| Constructor and Description |
|---|
OutputStreamWrapper(File file)
Creates a new wrapped stream that wraps the given regular file.
|
OutputStreamWrapper(OutputStream stream)
Creates a new wrapped stream that wraps the given stream.
|
OutputStreamWrapper(OutputStream stream,
boolean skipClose)
Creates a new wrapped stream that wraps the given stream.
|
OutputStreamWrapper(String name)
Creates a new wrapped stream that wraps:
the regular file with the given name (data is appended to the
file if the name is prefixed by
SpecialNames.PREFIX_APPEND),
or
the standard output stream (if the name is SpecialNames.STANDARD_OUTPUT), or
the standard error stream (if the name is SpecialNames.STANDARD_ERROR).
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
getSkipClose()
Returns true if the receiver's underlying stream will not be
closed when
close() is called. |
OutputStream |
getStream()
Returns the receiver's underlying stream.
|
public OutputStreamWrapper(String name) throws FileNotFoundException
SpecialNames.PREFIX_APPEND),
orSpecialNames.STANDARD_OUTPUT), orSpecialNames.STANDARD_ERROR).name - The file name.FileNotFoundException - Thrown if the name represents a
regular file, and it cannot be opened for writing.public OutputStreamWrapper(File file) throws FileNotFoundException
file - The file.FileNotFoundException - Thrown if the file cannot be
opened for writing.public OutputStreamWrapper(OutputStream stream, boolean skipClose)
close() is called
depending on the given flag.stream - The stream.skipClose - True if the underlying stream should not be
closed.public OutputStreamWrapper(OutputStream stream)
close() is
called; hence the given stream should not wrap (or be) the
standard output or error stream.stream - The stream.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic OutputStream getStream()
public boolean getSkipClose()
close() is called.Copyright © 2015. All Rights Reserved.