public class DocumentReader
extends java.io.Reader
Reader for javax.swing.text.Document objects.| 构造器和说明 |
|---|
DocumentReader(javax.swing.text.Document document)
Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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 在接口中 java.io.Closeableclose 在接口中 java.lang.AutoCloseableclose 在类中 java.io.Readerpublic void mark(int readAheadLimit)
reset() will reposition the stream to this point.mark 在类中 java.io.ReaderreadAheadLimit - Ignored.public boolean markSupported()
mark operation.
This always returns true for DocumentReader.markSupported 在类中 java.io.Readerpublic int read()
read 在类中 java.io.Readerpublic int read(char[] array)
array.length characters from the beginning
of the document into array.read 在类中 java.io.Readerarray - The array to read characters into.public int read(char[] cbuf,
int off,
int len)
read 在类中 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 在类中 java.io.Readertrue if the next read operation will
return without blocking.public void reset()
reset 在类中 java.io.Readerpublic long skip(long n)
skip 在类中 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.