Package org.fife.io
Class DocumentReader
java.lang.Object
java.io.Reader
org.fife.io.DocumentReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
A
Reader
for javax.swing.text.Document
objects.- Version:
- 1.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
This currently does nothing...void
mark
(int readAheadLimit) Marks the present position in the stream.boolean
Tells whether this reader supports themark
operation.int
read()
Reads the single character at the current position in the document.int
read
(char[] array) Readarray.length
characters from the beginning of the document intoarray
.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.Methods inherited from class java.io.Reader
nullReader, read, transferTo
-
Field Details
-
position
private long positionThe stream's position in the document. -
mark
private long markA remembered position in the document. -
document
The document we're working on. -
segment
Used for fast character access.
-
-
Constructor Details
-
DocumentReader
Constructor.- Parameters:
document
- The document we're 'reading'.
-
-
Method Details
-
close
public void close()This currently does nothing... -
mark
public void mark(int readAheadLimit) Marks the present position in the stream. Subsequent calls toreset()
will reposition the stream to this point. -
markSupported
public boolean markSupported()Tells whether this reader supports themark
operation. This always returnstrue
forDocumentReader
.- Overrides:
markSupported
in classReader
-
read
public int read()Reads the single character at the current position in the document. -
read
public int read(char[] array) Readarray.length
characters from the beginning of the document intoarray
. -
read
public int read(char[] cbuf, int off, int len) Reads characters into a portion of an array. -
ready
public boolean ready()Tells whether this reader is ready to be read without blocking for input.DocumentReader
will always return true. -
reset
public void reset()Resets the stream. If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then move it to the beginning of the document. -
skip
public long skip(long n) Skips characters. This will not 'skip' past the end of the document. -
seek
public void seek(long pos) Move to the specified position in the document. Ifpos
is greater than the document's length, the stream's position is moved to the end of the document.- Parameters:
pos
- The position in the document to move to.
-