org.apache.batik.parser

Class AbstractScanner

public abstract class AbstractScanner extends Object

An abstract scanner class to be extended.
Field Summary
protected intblankCharacters
The characters to skip to create the string which represents the current token.
protected char[]buffer
The recording buffer.
protected intcurrent
The current char.
protected intend
The end offset of the last lexical unit.
protected intposition
The current position in the buffer.
protected intpreviousType
The previous lexical unit type that was scanned.
protected NormalizingReaderreader
The reader.
protected intstart
The start offset of the last lexical unit.
protected inttype
The type of the current lexical unit.
Constructor Summary
AbstractScanner(Reader r)
Creates a new AbstractScanner object.
AbstractScanner(InputStream is, String enc)
Creates a new AbstractScanner object.
AbstractScanner(String s)
Creates a new AbstractScanner object.
Method Summary
voidclearBuffer()
Clears the buffer.
protected abstract intendGap()
Returns the end gap of the current lexical unit.
char[]getBuffer()
Returns the buffer used to store the chars.
intgetColumn()
Returns the current column.
intgetEnd()
Returns the end offset of the last lexical unit.
intgetLine()
Returns the current line.
intgetStart()
Returns the start offset of the last lexical unit.
StringgetStringValue()
Returns the string representation of the current lexical unit.
intgetType()
The current lexical unit type like defined in LexicalUnits.
protected static booleanisEqualIgnoreCase(int i, char c)
Compares the given int with the given character, ignoring case.
intnext()
Returns the next token.
protected intnextChar()
Sets the value of the current char to the next character or -1 if the end of stream has been reached.
protected abstract voidnextToken()
Returns the next token.

Field Detail

blankCharacters

protected int blankCharacters
The characters to skip to create the string which represents the current token.

buffer

protected char[] buffer
The recording buffer.

current

protected int current
The current char.

end

protected int end
The end offset of the last lexical unit.

position

protected int position
The current position in the buffer.

previousType

protected int previousType
The previous lexical unit type that was scanned.

reader

protected NormalizingReader reader
The reader.

start

protected int start
The start offset of the last lexical unit.

type

protected int type
The type of the current lexical unit.

Constructor Detail

AbstractScanner

public AbstractScanner(Reader r)
Creates a new AbstractScanner object.

Parameters: r The reader to scan.

AbstractScanner

public AbstractScanner(InputStream is, String enc)
Creates a new AbstractScanner object.

Parameters: is The input stream to scan. enc The encoding to use to decode the input stream, or null.

AbstractScanner

public AbstractScanner(String s)
Creates a new AbstractScanner object.

Parameters: s The string to scan.

Method Detail

clearBuffer

public void clearBuffer()
Clears the buffer.

endGap

protected abstract int endGap()
Returns the end gap of the current lexical unit.

getBuffer

public char[] getBuffer()
Returns the buffer used to store the chars.

getColumn

public int getColumn()
Returns the current column.

getEnd

public int getEnd()
Returns the end offset of the last lexical unit.

getLine

public int getLine()
Returns the current line.

getStart

public int getStart()
Returns the start offset of the last lexical unit.

getStringValue

public String getStringValue()
Returns the string representation of the current lexical unit.

getType

public int getType()
The current lexical unit type like defined in LexicalUnits.

isEqualIgnoreCase

protected static boolean isEqualIgnoreCase(int i, char c)
Compares the given int with the given character, ignoring case.

next

public int next()
Returns the next token.

nextChar

protected int nextChar()
Sets the value of the current char to the next character or -1 if the end of stream has been reached.

nextToken

protected abstract void nextToken()
Returns the next token.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.