|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
java.io.FilterReader
org.apache.commons.io.input.ProxyReader
com.armatiek.infofuze.stream.AutoCloseReader
public class AutoCloseReader
Proxy reader that closes and discards the underlying reader as soon as the end of input has been reached or when the reader is explicitly closed. Not even a reference to the underlying reader is kept after it has been closed, so any allocated in-memory buffers can be freed even if the client application still keeps a reference to the proxy reader.
Constructor Summary | |
---|---|
AutoCloseReader(java.io.Reader reader)
Creates an automatically closing proxy for the given reader. |
|
AutoCloseReader(java.io.Reader reader,
DataSourceIf source)
Creates an automatically closing proxy for the given reader. |
Method Summary | |
---|---|
void |
close()
Closes the underlying reader and replaces the reference to it with a ClosedReader instance. |
Methods inherited from class org.apache.commons.io.input.ProxyReader |
---|
mark, markSupported, read, read, read, read, ready, reset, skip |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AutoCloseReader(java.io.Reader reader)
in
- underlying readerpublic AutoCloseReader(java.io.Reader reader, DataSourceIf source)
in
- underlying readerMethod Detail |
---|
public void close() throws java.io.IOException
ClosedReader
instance.
This method is automatically called by the read methods when the end of input has been reached.
Note that it is safe to call this method any number of times. The original underlying input stream is closed and discarded only once when this method is first called.
close
in interface java.io.Closeable
close
in class org.apache.commons.io.input.ProxyReader
java.io.IOException
- if the underlying input stream can not be closed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |