org.teatrove.tea.io
Class SourceReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.FilterReader
          extended by org.teatrove.trove.io.PositionReader
              extended by org.teatrove.tea.io.PositionReader
                  extended by org.teatrove.tea.io.PushbackPositionReader
                      extended by org.teatrove.tea.io.SourceReader
All Implemented Interfaces:
Closeable, Readable

Deprecated. Moved to org.teatrove.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;

Author:
Brian S O'Neill

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

ENTER_CODE

public static final int ENTER_CODE
Deprecated. 
See Also:
Constant Field Values

ENTER_TEXT

public static final int ENTER_TEXT
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

SourceReader

public SourceReader(Reader source,
                    String beginTag,
                    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 String getBeginTag()
Deprecated. 

getEndTag

public String getEndTag()
Deprecated. 

read

public int read()
         throws IOException
Deprecated. 
All newline character patterns are are converted to \n.

Overrides:
read in class PushbackPositionReader
Throws:
IOException

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 IOException
Deprecated. 
Specified by:
close in interface Closeable
Overrides:
close in class PositionReader
Throws:
IOException

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(String[] arg)
                 throws Exception
Deprecated. 
Simple test program

Throws:
Exception


Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.