com.go.tea.io
Class SourceReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--java.io.FilterReader
              |
              +--com.go.trove.io.PositionReader
                    |
                    +--com.go.tea.io.PositionReader
                          |
                          +--com.go.tea.io.PushbackPositionReader
                                |
                                +--com.go.tea.io.SourceReader

Deprecated. Moved to com.go.trove.io package.

public class SourceReader
extends PushbackPositionReader

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;

Version:
16 , 12/11/00
Author:
Brian S O'Neill

Field Summary
static int ENTER_CODE
          Deprecated.  
static int ENTER_TEXT
          Deprecated.  
 
Fields inherited from class com.go.trove.io.PositionReader
mPosition, mPosReader
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
SourceReader(java.io.Reader source, java.lang.String beginTag, java.lang.String endTag)
          Deprecated. The begin and end tags for a SourceReader are optional.
 
Method Summary
 void close()
          Deprecated.  
 java.lang.String getBeginTag()
          Deprecated.  
 int getEndPosition()
          Deprecated. The position in the reader where the last read character ended.
 java.lang.String getEndTag()
          Deprecated.  
 int getLineNumber()
          Deprecated.  
 void ignoreTags(boolean ignore)
          Deprecated.  
 boolean isClosed()
          Deprecated.  
static void main(java.lang.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 com.go.tea.io.PushbackPositionReader
getStartPosition, peek, unread, unread
 
Methods inherited from class com.go.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTER_CODE

public static final int ENTER_CODE
Deprecated. 

ENTER_TEXT

public static final int ENTER_TEXT
Deprecated. 
Constructor Detail

SourceReader

public SourceReader(java.io.Reader source,
                    java.lang.String beginTag,
                    java.lang.String endTag)
Deprecated. 
The begin and end tags for a SourceReader are optional. If the begin tag is null or has zero length, then the SourceReader starts reading characters as if they were source code.

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.

Parameters:
source - the source reader
beginTag - tag that marks the beginning of a source code region
endTag - tag that marks the end of a source code region
Method Detail

getBeginTag

public java.lang.String getBeginTag()
Deprecated. 

getEndTag

public java.lang.String getEndTag()
Deprecated. 

read

public int read()
         throws java.io.IOException
Deprecated. 
All newline character patterns are are converted to \n.
Overrides:
read in class PushbackPositionReader

getLineNumber

public int getLineNumber()
Deprecated. 

getEndPosition

public int getEndPosition()
Deprecated. 
The position in the reader where the last read character ended. The position of the first character read from a Reader is zero.

The end position is usually the same as the start position, but sometimes a SourceReader may combine multiple characters into a single one.

Returns:
the end position where the last character was read

ignoreTags

public void ignoreTags(boolean ignore)
Deprecated. 

isClosed

public boolean isClosed()
Deprecated. 

close

public void close()
           throws java.io.IOException
Deprecated. 
Overrides:
close in class PositionReader

unreadHook

protected void unreadHook(int c)
Deprecated. 
Description copied from class: PushbackPositionReader
A hook call from the unread method(s). Every unread character is passed to this method.
Overrides:
unreadHook in class PushbackPositionReader

main

public static void main(java.lang.String[] arg)
                 throws java.lang.Exception
Deprecated. 
Simple test program