public final class NoCloseWriter extends Writer
close(),
useful for protecting stdout and stderr from beeing closed.
Trying to close via close() results in loosing connection
whereas reallyClose() really closes the writer.| Modifier and Type | Field and Description |
|---|---|
private static org.apache.commons.logging.Log |
LOG |
private Writer |
writer
A writer or
null. |
| Constructor and Description |
|---|
NoCloseWriter(Writer writer)
Create a NoCloseWriter that will protect writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Flushes the writer and looses the connection to it.
|
void |
flush() |
void |
reallyClose()
Really closes the underlying writer, with one exception ;-).
|
void |
write(char[] cbuf,
int off,
int len) |
private static final org.apache.commons.logging.Log LOG
private Writer writer
null.
The latter is the case if initialized with null,
or if tried to close via close().
In the latter case
it is not even possible to close with reallyClose().public void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOException - from the underlying writer.reallyClose()public void reallyClose()
throws IOException
IOException - from the underlying writer.NullPointerException - if the NoCloseWriter has been closed via close().Copyright © 2006–2018 Simuline Organization (l2r). All rights reserved.