com.jeffpalm.javaparser
Class CharStream

java.lang.Object
  extended by com.jeffpalm.javaparser.CharStream
Direct Known Subclasses:
JavaCharStream, SimpleCharStream

public abstract class CharStream
extends java.lang.Object

Basic character stream. The javacc tool creates one of four different types of character streams. To be able to switch between different types, I've created this parent class. The parent class invokes the appropriate child class that was created by javacc.

Version:
$Id: CharStream.java,v 1.3 2005/12/04 15:38:50 jeffpalm Exp $
Author:
Mike Atkinson, Mike Atkinson

Field Summary
static int ASCII
          Use the ascii character stream
protected  int available
          Are there more characters available
protected  int[] bufcolumn
          The buffer column
protected  char[] buffer
          The buffer
protected  int[] bufline
          The buffer line
 int bufpos
          The buffer location
protected  int bufsize
          The buffer size
protected  int column
          The column index
static int FULL_CHAR
          Use the unicode character stream
protected  int inBuf
          Index into the buffer
protected  java.io.Reader inputStream
          The input
static int JAVA_LIKE
          Use the Java character stream
protected  int line
          The line index
protected  int maxNextCharInd
          The maximum next character index
protected  boolean prevCharIsCR
          Was the previous character a CR?
protected  boolean prevCharIsLF
          Was the previous character a LF?
static boolean staticFlag
          Is this a parser
protected  int tokenBegin
          Index of the current token's starting point
static int UNICODE
          Use the unicode character stream
 
Constructor Summary
CharStream()
           
 
Method Summary
abstract  void adjustBeginLineColumn(int newLine, int newCol)
          Description of the Method
abstract  void backup(int amount)
          Description of the Method
 char BeginToken()
          Description of the Method
 int getBeginColumn()
          Gets the BeginColumn attribute of the CharStream class
 int getBeginLine()
          Gets the BeginLine attribute of the CharStream class
 int getColumn()
          Deprecated.  
 int getEndColumn()
          Gets the EndColumn attribute of the CharStream class
 int getEndLine()
          Gets the EndLine attribute of the CharStream class
abstract  java.lang.String GetImage()
          Description of the Method
 int getLine()
          Deprecated.  
abstract  char[] GetSuffix(int len)
          Description of the Method
static CharStream make(java.io.InputStream dstream, int startline, int startcolumn)
          Constructor for the CharStream object
static CharStream make(java.io.InputStream dstream, int startline, int startcolumn, int buffersize)
          Constructor for the CharStream object
static CharStream make(java.io.Reader dstream, int startline, int startcolumn)
          Constructor for the CharStream object
static CharStream make(java.io.Reader dstream, int startline, int startcolumn, int buffersize)
          Constructor for the CharStream object
abstract  char readChar()
          Description of the Method
 void ReInit(java.io.InputStream dstream, int startline, int startcolumn)
          Description of the Method
 void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize)
          Description of the Method
 void ReInit(java.io.Reader dstream, int startline, int startcolumn)
          Description of the Method
abstract  void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize)
          Description of the Method
static void setCharStreamType(int type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

available

protected int available
Are there more characters available


bufcolumn

protected int[] bufcolumn
The buffer column


buffer

protected char[] buffer
The buffer


bufline

protected int[] bufline
The buffer line


bufpos

public int bufpos
The buffer location


bufsize

protected int bufsize
The buffer size


column

protected int column
The column index


inBuf

protected int inBuf
Index into the buffer


inputStream

protected java.io.Reader inputStream
The input


line

protected int line
The line index


maxNextCharInd

protected int maxNextCharInd
The maximum next character index


prevCharIsCR

protected boolean prevCharIsCR
Was the previous character a CR?


prevCharIsLF

protected boolean prevCharIsLF
Was the previous character a LF?


tokenBegin

protected int tokenBegin
Index of the current token's starting point


ASCII

public static final int ASCII
Use the ascii character stream

See Also:
Constant Field Values

FULL_CHAR

public static final int FULL_CHAR
Use the unicode character stream

See Also:
Constant Field Values

JAVA_LIKE

public static final int JAVA_LIKE
Use the Java character stream

See Also:
Constant Field Values

UNICODE

public static final int UNICODE
Use the unicode character stream

See Also:
Constant Field Values

staticFlag

public static final boolean staticFlag
Is this a parser

See Also:
Constant Field Values
Constructor Detail

CharStream

public CharStream()
Method Detail

GetImage

public abstract java.lang.String GetImage()
Description of the Method

Returns:
Description of the Returned Value

GetSuffix

public abstract char[] GetSuffix(int len)
Description of the Method

Parameters:
len - Description of Parameter
Returns:
Description of the Returned Value

getBeginColumn

public int getBeginColumn()
Gets the BeginColumn attribute of the CharStream class

Returns:
The BeginColumn value

getBeginLine

public int getBeginLine()
Gets the BeginLine attribute of the CharStream class

Returns:
The BeginLine value

getColumn

public int getColumn()
Deprecated. 

Gets the Column attribute of the CharStream class

Returns:
The Column value
See Also:
getEndColumn()

getEndColumn

public int getEndColumn()
Gets the EndColumn attribute of the CharStream class

Returns:
The EndColumn value

getEndLine

public int getEndLine()
Gets the EndLine attribute of the CharStream class

Returns:
The EndLine value

getLine

public int getLine()
Deprecated. 

Gets the Line attribute of the CharStream class

Returns:
The Line value
See Also:
getEndLine()

BeginToken

public char BeginToken()
                throws java.io.IOException
Description of the Method

Returns:
Description of the Returned Value
Throws:
java.io.IOException - Description of Exception

ReInit

public abstract void ReInit(java.io.Reader dstream,
                            int startline,
                            int startcolumn,
                            int buffersize)
Description of the Method

Parameters:
dstream - Description of Parameter
startline - Description of Parameter
startcolumn - Description of Parameter
buffersize - Description of Parameter

ReInit

public void ReInit(java.io.Reader dstream,
                   int startline,
                   int startcolumn)
Description of the Method

Parameters:
dstream - Description of Parameter
startline - Description of Parameter
startcolumn - Description of Parameter

ReInit

public void ReInit(java.io.InputStream dstream,
                   int startline,
                   int startcolumn,
                   int buffersize)
Description of the Method

Parameters:
dstream - Description of Parameter
startline - Description of Parameter
startcolumn - Description of Parameter
buffersize - Description of Parameter

ReInit

public void ReInit(java.io.InputStream dstream,
                   int startline,
                   int startcolumn)
Description of the Method

Parameters:
dstream - Description of Parameter
startline - Description of Parameter
startcolumn - Description of Parameter

adjustBeginLineColumn

public abstract void adjustBeginLineColumn(int newLine,
                                           int newCol)
Description of the Method

Parameters:
newLine - Description of Parameter
newCol - Description of Parameter

backup

public abstract void backup(int amount)
Description of the Method

Parameters:
amount - Description of Parameter

readChar

public abstract char readChar()
                       throws java.io.IOException
Description of the Method

Returns:
Description of the Returned Value
Throws:
java.io.IOException - Description of Exception

setCharStreamType

public static void setCharStreamType(int type)

make

public static CharStream make(java.io.Reader dstream,
                              int startline,
                              int startcolumn,
                              int buffersize)
Constructor for the CharStream object

Parameters:
dstream - Description of Parameter
startline - Description of Parameter
startcolumn - Description of Parameter
buffersize - Description of Parameter
Returns:
Description of the Returned Value

make

public static CharStream make(java.io.Reader dstream,
                              int startline,
                              int startcolumn)
Constructor for the CharStream object

Parameters:
dstream - Description of Parameter
startline - Description of Parameter
startcolumn - Description of Parameter
Returns:
Description of the Returned Value

make

public static CharStream make(java.io.InputStream dstream,
                              int startline,
                              int startcolumn,
                              int buffersize)
Constructor for the CharStream object

Parameters:
dstream - Description of Parameter
startline - Description of Parameter
startcolumn - Description of Parameter
buffersize - Description of Parameter
Returns:
Description of the Returned Value

make

public static CharStream make(java.io.InputStream dstream,
                              int startline,
                              int startcolumn)
Constructor for the CharStream object

Parameters:
dstream - Description of Parameter
startline - Description of Parameter
startcolumn - Description of Parameter
Returns:
Description of the Returned Value