Package org.apache.batik.parser
Class AbstractScanner
java.lang.Object
org.apache.batik.parser.AbstractScanner
- Direct Known Subclasses:
XPathSubsetContentSelector.Scanner
An abstract scanner class to be extended.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
The characters to skip to create the string which represents the current token.protected char[]
The recording buffer.protected int
The current char.protected int
The end offset of the last lexical unit.protected int
The current position in the buffer.protected int
The previous lexical unit type that was scanned.protected NormalizingReader
The reader.protected int
The start offset of the last lexical unit.protected int
The type of the current lexical unit. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractScanner
(InputStream is, String enc) Creates a new AbstractScanner object.Creates a new AbstractScanner object.Creates a new AbstractScanner object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the buffer.protected abstract int
endGap()
Returns the end gap of the current lexical unit.char[]
Returns the buffer used to store the chars.int
Returns the current column.int
getEnd()
Returns the end offset of the last lexical unit.int
getLine()
Returns the current line.int
getStart()
Returns the start offset of the last lexical unit.Returns the string representation of the current lexical unit.int
getType()
The current lexical unit type like defined in LexicalUnits.protected static boolean
isEqualIgnoreCase
(int i, char c) Compares the given int with the given character, ignoring case.int
next()
Returns the next token.protected int
nextChar()
Sets the value of the current char to the next character or -1 if the end of stream has been reached.protected abstract void
Returns the next token.
-
Field Details
-
reader
The reader. -
current
protected int currentThe current char. -
buffer
protected char[] bufferThe recording buffer. -
position
protected int positionThe current position in the buffer. -
type
protected int typeThe type of the current lexical unit. -
previousType
protected int previousTypeThe previous lexical unit type that was scanned. -
start
protected int startThe start offset of the last lexical unit. -
end
protected int endThe end offset of the last lexical unit. -
blankCharacters
protected int blankCharactersThe characters to skip to create the string which represents the current token.
-
-
Constructor Details
-
AbstractScanner
Creates a new AbstractScanner object.- Parameters:
r
- The reader to scan.- Throws:
ParseException
-
AbstractScanner
Creates a new AbstractScanner object.- Parameters:
is
- The input stream to scan.enc
- The encoding to use to decode the input stream, or null.- Throws:
ParseException
-
AbstractScanner
Creates a new AbstractScanner object.- Parameters:
s
- The string to scan.- Throws:
ParseException
-
-
Method Details
-
getLine
public int getLine()Returns the current line. -
getColumn
public int getColumn()Returns the current column. -
getBuffer
public char[] getBuffer()Returns the buffer used to store the chars. -
getStart
public int getStart()Returns the start offset of the last lexical unit. -
getEnd
public int getEnd()Returns the end offset of the last lexical unit. -
clearBuffer
public void clearBuffer()Clears the buffer. -
getType
public int getType()The current lexical unit type like defined in LexicalUnits. -
getStringValue
Returns the string representation of the current lexical unit. -
next
Returns the next token.- Throws:
ParseException
-
endGap
protected abstract int endGap()Returns the end gap of the current lexical unit. -
nextToken
Returns the next token.- Throws:
ParseException
-
isEqualIgnoreCase
protected static boolean isEqualIgnoreCase(int i, char c) Compares the given int with the given character, ignoring case. -
nextChar
Sets the value of the current char to the next character or -1 if the end of stream has been reached.- Throws:
IOException
-