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.Closeable
close
在接口中 java.lang.AutoCloseable
close
在类中 java.io.Reader
public void mark(int readAheadLimit)
reset()
will reposition the stream to this point.mark
在类中 java.io.Reader
readAheadLimit
- Ignored.public boolean markSupported()
mark
operation.
This always returns true
for DocumentReader
.markSupported
在类中 java.io.Reader
public int read()
read
在类中 java.io.Reader
public int read(char[] array)
array.length
characters from the beginning
of the document into array
.read
在类中 java.io.Reader
array
- The array to read characters into.public int read(char[] cbuf, int off, int len)
read
在类中 java.io.Reader
cbuf
- 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.Reader
true
if the next read operation will
return without blocking.public void reset()
reset
在类中 java.io.Reader
public long skip(long n)
skip
在类中 java.io.Reader
n
- 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.