|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Reader
java.io.FilterReader
org.teatrove.trove.io.PositionReader
org.teatrove.tea.io.PositionReader
org.teatrove.tea.io.PushbackPositionReader
org.teatrove.tea.io.SourceReader
public class SourceReader
The SourceReader provides several services for reading source input. It calculates line numbers, position in the source file, supports two character pushback, extracts code from text that allows mixed code and plain text, and it processes unicode escape sequences that appear in source code.
Readers return -1 when the end of the stream, has been reached, and so does SourceReader. SourceReader will also return other special negative values to indicate a tag substitution. ENTER_CODE is returned to indicate that characters read are in source code, and ENTER_TEXT is returned to indicate that characters read are in plain text. The first character read from a SourceReader is either ENTER_CODE or ENTER_TEXT;
| Field Summary | |
|---|---|
static int |
ENTER_CODE
Deprecated. |
static int |
ENTER_TEXT
Deprecated. |
| Fields inherited from class org.teatrove.trove.io.PositionReader |
|---|
mPosition, mPosReader |
| Fields inherited from class java.io.FilterReader |
|---|
in |
| Fields inherited from class java.io.Reader |
|---|
lock |
| Constructor Summary | |
|---|---|
SourceReader(Reader source,
String beginTag,
String endTag)
Deprecated. The begin and end tags for a SourceReader are optional. |
|
| Method Summary | |
|---|---|
void |
close()
Deprecated. |
String |
getBeginTag()
Deprecated. |
int |
getEndPosition()
Deprecated. The position in the reader where the last read character ended. |
String |
getEndTag()
Deprecated. |
int |
getLineNumber()
Deprecated. |
void |
ignoreTags(boolean ignore)
Deprecated. |
boolean |
isClosed()
Deprecated. |
static void |
main(String[] arg)
Deprecated. Simple test program |
int |
read()
Deprecated. All newline character patterns are are converted to \n. |
protected void |
unreadHook(int c)
Deprecated. A hook call from the unread method(s). |
| Methods inherited from class org.teatrove.tea.io.PushbackPositionReader |
|---|
getStartPosition, peek, unread, unread |
| Methods inherited from class org.teatrove.trove.io.PositionReader |
|---|
getNextPosition, read |
| Methods inherited from class java.io.FilterReader |
|---|
mark, markSupported, ready, reset, skip |
| Methods inherited from class java.io.Reader |
|---|
read, read |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ENTER_CODE
public static final int ENTER_TEXT
| Constructor Detail |
|---|
public SourceReader(Reader source,
String beginTag,
String endTag)
If the end tag is null or has zero length, then a source code region continues to the end of the input Reader's characters.
source - the source readerbeginTag - tag that marks the beginning of a source code regionendTag - tag that marks the end of a source code region| Method Detail |
|---|
public String getBeginTag()
public String getEndTag()
public int read()
throws IOException
read in class PushbackPositionReaderIOExceptionpublic int getLineNumber()
public int getEndPosition()
The end position is usually the same as the start position, but sometimes a SourceReader may combine multiple characters into a single one.
public void ignoreTags(boolean ignore)
public boolean isClosed()
public void close()
throws IOException
close in interface Closeableclose in class PositionReaderIOExceptionprotected void unreadHook(int c)
PushbackPositionReader
unreadHook in class PushbackPositionReader
public static void main(String[] arg)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||