|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
net.sf.japaki.io.SlicedReader
public class SlicedReader
A sliced reader is a reader that can be "sliced". A slice is a kind of clone that is based on the same reader as the original but stores its own position in the character stream. The ability to keep the position depends on the size of the underlying buffer.
Field Summary |
---|
Fields inherited from class java.io.Reader |
---|
lock |
Constructor Summary | |
---|---|
protected |
SlicedReader(ReaderBuffer buffer)
Constructs a new sliced reader based on the given reader. |
Method Summary | |
---|---|
void |
close()
|
protected int |
getPosition()
Returns the current position. |
static SlicedReader |
newReader(Reader in)
Constructs a new sliced reader based on the given reader. |
static SlicedReader |
newReader(Reader in,
int sz)
Constructs a new sliced reader based on the given reader. |
int |
read(char[] cbuf,
int off,
int len)
|
SlicedReader |
slice()
Creates a slice of this reader. |
Methods inherited from class java.io.Reader |
---|
mark, markSupported, read, read, read, ready, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected SlicedReader(ReaderBuffer buffer)
buffer
- base buffer
NullPointerException
- if buffer
is null
Method Detail |
---|
public static SlicedReader newReader(Reader in, int sz)
in
- base readersz
- size to allocate for the buffer
NullPointerException
- if in
is null
IllegalArgumentException
- if the size is a negative integerpublic static SlicedReader newReader(Reader in)
in
- base reader
NullPointerException
- if in
is null
protected int getPosition()
public SlicedReader slice()
public int read(char[] cbuf, int off, int len) throws IOException
read
in class Reader
IOException
public void close() throws IOException
close
in interface Closeable
close
in class Reader
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |