public class WriterWrapper extends Object implements Closeable
Writer instance. This wrapper
is intended to wrap Writer 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 |
|---|
WriterWrapper(File file)
Creates a new wrapped writer that wraps the given regular file.
|
WriterWrapper(File file,
SignatureCharset requestedSignatureCharset)
Creates a new wrapped writer that wraps the given regular
file.
|
WriterWrapper(String name)
Creates a new wrapped writer 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).
The default JVM charset is used to convert characters into
bytes. |
WriterWrapper(String name,
SignatureCharset requestedSignatureCharset)
Creates a new wrapped writer 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).
A writer that can inject unicode BOMs is used as a proxy; that
writer uses the given signature/charset. |
WriterWrapper(Writer writer)
Creates a new wrapped writer that wraps the given writer.
|
WriterWrapper(Writer writer,
boolean skipClose)
Creates a new wrapped writer that wraps the given writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
getSkipClose()
Returns true if the receiver's underlying writer will not be
closed when
close() is called. |
Writer |
getWriter()
Returns the receiver's underlying writer.
|
public WriterWrapper(String name, SignatureCharset requestedSignatureCharset) throws FileNotFoundException
SpecialNames.PREFIX_APPEND),
orSpecialNames.STANDARD_OUTPUT), orSpecialNames.STANDARD_ERROR).name - The file name.requestedSignatureCharset - The signature/charset. It may
be null to use the default JVM charset.FileNotFoundException - Thrown if the name represents a
regular file, and it cannot be opened for writing.public WriterWrapper(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 WriterWrapper(File file, SignatureCharset requestedSignatureCharset) throws FileNotFoundException
file - The file.requestedSignatureCharset - The signature/charset. It may
be null to use the default JVM charset.FileNotFoundException - Thrown if the file cannot be
opened for writing.public WriterWrapper(File file) throws FileNotFoundException
file - The file.FileNotFoundException - Thrown if the file cannot be
opened for writing.public WriterWrapper(Writer writer, boolean skipClose)
close() is called
depending on the given flag.writer - The writer.skipClose - True if the underlying writer should not be
closed.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic Writer getWriter()
public boolean getSkipClose()
close() is called.Copyright © 2015. All Rights Reserved.