|
||||||||||
| 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.CloseShieldWriter<T>
T - Type of the Writer passed in the constructor.public class CloseShieldWriter<T extends Writer>
A CloseShieldWriter wraps some other Writer, which
it uses as its basic sink of data. The class CloseShieldWriter
delegates all requests to the contained writer, except the
close() method that is not to the underlying stream.
This class is typically used in cases where a Writer needs to be
passed to a component that wants to explicitly close the stream but other
components still need to write data on it.
| Field Summary |
|---|
| Fields inherited from class java.io.FilterWriter |
|---|
out |
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
CloseShieldWriter(T source)
Construct a CloseShieldWriter 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 CloseShieldWriter(T source)
CloseShieldWriter that forwards the calls to the
source Writer passed in the constructor.
T - a T object.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 | |||||||||