public class DocumentReader
extends java.io.Reader
Reader for javax.swing.text.Document objects.| Constructor and Description |
|---|
DocumentReader(javax.swing.text.Document document)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This currently does nothing...
|
void |
mark(int readAheadLimit)
Marks the present position in the stream.
|
boolean |
markSupported()
Tells whether this reader supports the
mark operation. |
int |
read()
Reads the single character at the current position in the document.
|
int |
read(char[] array)
Read
array.length characters from the beginning
of the document into array. |
int |
read(char[] cbuf,
int off,
int len)
Reads characters into a portion of an array.
|
boolean |
ready()
Tells whether this reader is ready to be read without
blocking for input.
|
void |
reset()
Resets the stream.
|
void |
seek(long pos)
Move to the specified position in the document.
|
long |
skip(long n)
Skips characters.
|
public DocumentReader(javax.swing.text.Document document)
document - The document we're 'reading'.public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerpublic void mark(int readAheadLimit)
reset() will reposition the stream to this point.mark in class java.io.ReaderreadAheadLimit - Ignored.public boolean markSupported()
mark operation.
This always returns true for DocumentReader.markSupported in class java.io.Readerpublic int read()
read in class java.io.Readerpublic int read(char[] array)
array.length characters from the beginning
of the document into array.read in class java.io.Readerarray - The array to read characters into.public int read(char[] cbuf,
int off,
int len)
read in class java.io.Readercbuf - The destination buffer.off - Offset at which to start storing characters.len - Maximum number of characters to read.-1 if the
end of the stream (document) has been reached.public boolean ready()
DocumentReader will
always return true.ready in class java.io.Readertrue if the next read operation will
return without blocking.public void reset()
reset in class java.io.Readerpublic long skip(long n)
skip in class java.io.Readern - The number of characters to skip.public void seek(long pos)
pos
is greater than the document's length, the stream's position is moved
to the end of the document.pos - The position in the document to move to.