org.exolab.castor.xml.dtd.parser

Class InputCharStream

Implemented Interfaces:
CharStream

public final class InputCharStream
extends java.lang.Object
implements CharStream

An implementation of interface CharStream. Implements input character stream that maintains line and column number positions of the characters. It also has the capability to backup the stream to some extent.
The object of this class is constructed using java.io.Reader reader and it is left to constructor of the reader to set up character encoding correctly. This means that method read of the reader is used to get next characters, assuming it returns appropriate values. It is recommended to use class java.io.InputStreamReader as a reader, which allows to set desired character encoding. This class is an intermediate component between input character reader and the parser.
The code of this class is based on the class ASCII_CharStream - implementation of interface CharStream, that JavaCC would have generated with the following options set in a JavaCC grammar file:

    JAVA_UNICODE_ESCAPE = false;

    UNICODE_INPUT = false;

    USER_CHAR_STREAM = false; 
Note that this class is not fully JavaCC generated.
Version:
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:09:26 $
Author:
JavaCC, Alexander Totok

Field Summary

(package private) int
available
int
bufpos
(package private) int
bufsize
static boolean
staticFlag
(package private) int
tokenBegin

Constructor Summary

InputCharStream(java.io.Reader dstream)
Constructor, instantiating the char stream to begin at 1-st line and 1-st column of dstream.
InputCharStream(java.io.Reader dstream, int startline, int startcolumn)
Constructor, allowing to specify start line and start column of the char stream.
InputCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize)
Constructor, allowing to specify start line and start column of the char stream, and buffer size as well.

Method Summary

char
BeginToken()
void
Done()
String
GetImage()
char[]
GetSuffix(int len)
void
ReInit(java.io.Reader dstream)
Reinitialization of the char stream, instantiating the char stream to begin at 1-st line and 1-st column of dstream.
void
ReInit(java.io.Reader dstream, int startline, int startcolumn)
Reinitialization of the char stream, allowing to specify start line and start column of the char stream.
void
ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize)
Reinitialization of the char stream, allowing to specify start line and start column of the char stream, and buffer size as well.
void
adjustBeginLineColumn(int newLine, int newCol)
Method to adjust line and column numbers for the start of a token.
void
backup(int amount)
int
getBeginColumn()
int
getBeginLine()
int
getColumn()
Deprecated.
int
getEndColumn()
int
getEndLine()
int
getLine()
Deprecated.
char
readChar()
Returns the next character from the input stream.

Field Details

available

(package private)  int available

bufpos

public int bufpos

bufsize

(package private)  int bufsize

staticFlag

public static final boolean staticFlag
Field Value:
false

tokenBegin

(package private)  int tokenBegin

Constructor Details

InputCharStream

public InputCharStream(java.io.Reader dstream)
Constructor, instantiating the char stream to begin at 1-st line and 1-st column of dstream.

InputCharStream

public InputCharStream(java.io.Reader dstream,
                       int startline,
                       int startcolumn)
Constructor, allowing to specify start line and start column of the char stream.

InputCharStream

public InputCharStream(java.io.Reader dstream,
                       int startline,
                       int startcolumn,
                       int buffersize)
Constructor, allowing to specify start line and start column of the char stream, and buffer size as well.

Method Details

BeginToken

public final char BeginToken()
            throws java.io.IOException
Specified by:
BeginToken in interface CharStream

Done

public void Done()
Specified by:
Done in interface CharStream

GetImage

public final String GetImage()
Specified by:
GetImage in interface CharStream

GetSuffix

public final char[] GetSuffix(int len)
Specified by:
GetSuffix in interface CharStream

ReInit

public void ReInit(java.io.Reader dstream)
Reinitialization of the char stream, instantiating the char stream to begin at 1-st line and 1-st column of dstream.

ReInit

public void ReInit(java.io.Reader dstream,
                   int startline,
                   int startcolumn)
Reinitialization of the char stream, allowing to specify start line and start column of the char stream.

ReInit

public void ReInit(java.io.Reader dstream,
                   int startline,
                   int startcolumn,
                   int buffersize)
Reinitialization of the char stream, allowing to specify start line and start column of the char stream, and buffer size as well.

adjustBeginLineColumn

public void adjustBeginLineColumn(int newLine,
                                  int newCol)
Method to adjust line and column numbers for the start of a token.

backup

public final void backup(int amount)
Specified by:
backup in interface CharStream

getBeginColumn

public final int getBeginColumn()
Specified by:
getBeginColumn in interface CharStream

getBeginLine

public final int getBeginLine()
Specified by:
getBeginLine in interface CharStream

getColumn

public final int getColumn()

Deprecated.

Specified by:
getColumn in interface CharStream

getEndColumn

public final int getEndColumn()
Specified by:
getEndColumn in interface CharStream

getEndLine

public final int getEndLine()
Specified by:
getEndLine in interface CharStream

getLine

public final int getLine()

Deprecated.

Specified by:
getLine in interface CharStream
See Also:
getEndLine()

readChar

public final char readChar()
            throws java.io.IOException
Returns the next character from the input stream. The only method whose implementation is different from its original in the ASCII_CharStream class.
Specified by:
readChar in interface CharStream

Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com