|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
java.io.FilterWriter
com.gc.iotools.stream.writer.CloseOnceWriter<T>
T - Type of the Writer passed in the constructor.public class CloseOnceWriter<T extends Writer>
A CloseOnceWriter wraps some other Writer
preventing multiple invocations of the method close().
It forwards all requests to the contained writer, except the close() method that is passed only one time to the underlying stream.
This is useful with some non conforming Writer that don't allow
close() to be called multiple times.
Writer.close()| Field Summary |
|---|
| Fields inherited from class java.io.FilterWriter |
|---|
out |
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
CloseOnceWriter(T source)
Construct a CloseOnceWriter that forwards the calls to the
source Writer passed in the constructor. |
|
| Method Summary | |
|---|---|
void |
close()
|
int |
getCloseCount()
Returns the number of time that close was called. |
T |
getWrappedWriter()
Returns the wrapped (original) Writer passed in the
constructor. |
| Methods inherited from class java.io.FilterWriter |
|---|
flush, write, write, write |
| Methods inherited from class java.io.Writer |
|---|
append, append, append, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CloseOnceWriter(T source)
CloseOnceWriter that forwards the calls to the
source Writer passed in the constructor.
source - original Writer| Method Detail |
|---|
public void close()
throws IOException
Multiple invocation of this method will result in only one invocation of
the close() on the underlying stream.
close in interface Closeableclose in class FilterWriterIOExceptionpublic int getCloseCount()
public T getWrappedWriter()
Returns the wrapped (original) Writer passed in the
constructor.
Writer passed in the constructor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||