|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
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 pass 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 even if
other components still want to write data on it.
| Field Summary |
|---|
| 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 | |
|---|---|
Writer |
append(char c)
|
Writer |
append(CharSequence csq)
|
Writer |
append(CharSequence csq,
int start,
int end)
|
void |
close()
|
void |
flush()
|
int |
getCloseCount()
Returns the number of time that close was called. |
T |
getWrappedWriter()
Returns the wrapped (original) Writer passed in the
constructor. |
String |
toString()
|
void |
write(char[] cbuf)
|
void |
write(char[] cbuf,
int off,
int len)
|
void |
write(int c)
|
void |
write(String str)
|
void |
write(String str,
int off,
int len)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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 Writer append(char c)
throws IOException
append in interface Appendableappend in class WriterIOException
public Writer append(CharSequence csq)
throws IOException
append in interface Appendableappend in class WriterIOException
public Writer append(CharSequence csq,
int start,
int end)
throws IOException
append in interface Appendableappend in class WriterIOException
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 WriterIOException
public void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic int getCloseCount()
public T getWrappedWriter()
Returns the wrapped (original) Writer passed in the
constructor.
Writer passed in the constructorpublic String toString()
toString in class Object
public void write(char[] cbuf)
throws IOException
write in class WriterIOException
public void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOException
public void write(int c)
throws IOException
write in class WriterIOException
public void write(String str)
throws IOException
write in class WriterIOException
public void write(String str,
int off,
int len)
throws IOException
write in class WriterIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||