|
|||||||||
| Home >> All >> org >> sourceforge >> ProDBA >> SqlWorkbench >> [ syntax overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.sourceforge.ProDBA.SqlWorkbench.syntax
Class DocumentReader

java.lang.Objectjava.io.Reader
org.sourceforge.ProDBA.SqlWorkbench.syntax.DocumentReader
- public class DocumentReader
- extends java.io.Reader
Since the lexer only works with readers and strings, this implementation will be used for the syntax highlighting package. The close method does nothing, and the seek method has been added, so we should be able to get some performance increase.
| Field Summary | |
private javax.swing.text.AbstractDocument |
doc
The document we are reading |
private long |
mark
Saved position used in the mark and reset methods |
private long |
pos
The current position in the document |
| Fields inherited from class java.io.Reader |
lock |
| Constructor Summary | |
DocumentReader(javax.swing.text.AbstractDocument document)
|
|
| Method Summary | |
void |
close()
Has no effect. |
void |
mark(int readAheadLimit)
Save a position for reset |
boolean |
markSupported()
This reader supports mark and reset |
int |
read()
Read a single character of the document |
int |
read(char[] cbuf)
Read and fill the buffer. |
int |
read(char[] cbuf,
int offs,
int len)
Read chars from a stream and stores them into a caller supplied buffer. |
boolean |
ready()
Determines whether or not this stream is ready to be read. |
void |
seek(long n)
|
long |
skip(long n)
Skips the specified number of chars in the stream. |
void |
update(int pos,
int adj)
Modifying the document while the reader is reading corrupts the reader. |
| Methods inherited from class java.io.Reader |
reset |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
pos
private long pos
- The current position in the document
mark
private long mark
- Saved position used in the mark and reset methods
doc
private javax.swing.text.AbstractDocument doc
- The document we are reading
| Constructor Detail |
DocumentReader
public DocumentReader(javax.swing.text.AbstractDocument document)
| Method Detail |
update
public void update(int pos,
int adj)
- Modifying the document while the reader is reading corrupts the reader.
This method should be called in a thread safe way to allow the reader
to compensate.
close
public void close()
- Has no effect. The reader can be used even after close is called.
mark
public void mark(int readAheadLimit)
- Save a position for reset
markSupported
public boolean markSupported()
- This reader supports mark and reset
read
public int read()
- Read a single character of the document
read
public int read(char[] cbuf)
- Read and fill the buffer.
This method will always fill the buffer until the end of the document is reached.
read
public int read(char[] cbuf,
int offs,
int len)
- Description copied from class:
java.io.Reader - Read chars from a stream and stores them into a caller
supplied buffer. It starts storing the data at index
offsetinto the buffer and attempts to readlenchars. This method can return before reading the number of chars requested. The actual number of chars read is returned as an int. A -1 is returned to indicate the end of the stream.This method will block until some data can be read.
This method operates by calling the single char
read()method in a loop until the desired number of chars are read. The read loop stops short if the end of the stream is encountered or if an IOException is encountered on any read operation except the first. If the first attempt to read a chars fails, the IOException is allowed to propagate upward. And subsequent IOException is caught and treated identically to an end of stream condition. Subclasses can (and should if possible) override this method to provide a more efficient implementation.
ready
public boolean ready()
- Description copied from class:
java.io.Reader - Determines whether or not this stream is ready to be
read. If it returns
falsethe stream may block if a read is attempted, but it is not guaranteed to do so.This method always returns
falsein this class
skip
public long skip(long n)
- Description copied from class:
java.io.Reader - Skips the specified number of chars in the stream. It
returns the actual number of chars skipped, which may be less than the
requested amount.
This method reads and discards chars into a 256 char array until the specified number of chars were skipped or until either the end of stream is reached or a read attempt returns a short count. Subclasses can override this method to provide a more efficient implementation where one exists.
seek
public void seek(long n)
|
|||||||||
| Home >> All >> org >> sourceforge >> ProDBA >> SqlWorkbench >> [ syntax overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC