|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Reader
com.gc.iotools.stream.reader.CloseOnceReader<T>
T - Type of the Reader passed in the constructor.public class CloseOnceReader<T extends Reader>
A CloseOnceReader wraps some other Reader, which
it uses as its basic source of data. The class CloseOnceReader
pass all requests to the contained input stream, except the
close() method that is passed only one time to the underlying
stream.
Multiple invocation of the close() method will result in only
one invocation of the same method on the underlying stream. This is useful
with some buggy Reader that don't allow close()
to be called multiple times.
| Field Summary |
|---|
| Fields inherited from class java.io.Reader |
|---|
lock |
| Constructor Summary | |
|---|---|
CloseOnceReader(T source)
Construct a CloseOnceReader that forwards the calls to the
source Reader passed in the constructor. |
|
| Method Summary | |
|---|---|
void |
close()
|
int |
getCloseCount()
Returns the number of time that close was called. |
T |
getWrappedReader()
Returns the wrapped (original) Reader passed in the
constructor. |
void |
mark(int readAheadLimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(char[] cbuf)
|
int |
read(char[] cbuf,
int off,
int len)
|
int |
read(CharBuffer target)
|
boolean |
ready()
|
void |
reset()
|
long |
skip(long n)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CloseOnceReader(T source)
CloseOnceReader that forwards the calls to the
source Reader passed in the constructor.
source - original Reader| 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 ReaderIOExceptionpublic int getCloseCount()
public T getWrappedReader()
Returns the wrapped (original) Reader passed in the
constructor.
Reader passed in the constructor
public void mark(int readAheadLimit)
throws IOException
mark in class ReaderIOExceptionpublic boolean markSupported()
markSupported in class Reader
public int read()
throws IOException
read in class ReaderIOException
public int read(char[] cbuf)
throws IOException
read in class ReaderIOException
public int read(char[] cbuf,
int off,
int len)
throws IOException
read in class ReaderIOException
public int read(CharBuffer target)
throws IOException
read in interface Readableread in class ReaderIOException
public boolean ready()
throws IOException
ready in class ReaderIOException
public void reset()
throws IOException
reset in class ReaderIOException
public long skip(long n)
throws IOException
skip in class ReaderIOExceptionpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||