Package org.apache.batik.parser
Class AbstractScanner
- java.lang.Object
-
- org.apache.batik.parser.AbstractScanner
-
- Direct Known Subclasses:
XPathSubsetContentSelector.Scanner
public abstract class AbstractScanner extends java.lang.ObjectAn abstract scanner class to be extended.- Version:
- $Id: AbstractScanner.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Field Summary
Fields Modifier and Type Field Description protected intblankCharactersThe characters to skip to create the string which represents the current token.protected char[]bufferThe recording buffer.protected intcurrentThe current char.protected intendThe end offset of the last lexical unit.protected intpositionThe current position in the buffer.protected intpreviousTypeThe previous lexical unit type that was scanned.protected NormalizingReaderreaderThe reader.protected intstartThe start offset of the last lexical unit.protected inttypeThe type of the current lexical unit.
-
Constructor Summary
Constructors Constructor Description AbstractScanner(java.io.InputStream is, java.lang.String enc)Creates a new AbstractScanner object.AbstractScanner(java.io.Reader r)Creates a new AbstractScanner object.AbstractScanner(java.lang.String s)Creates a new AbstractScanner object.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.java.lang.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
-
reader
protected NormalizingReader reader
The reader.
-
current
protected int current
The current char.
-
buffer
protected char[] buffer
The recording buffer.
-
position
protected int position
The current position in the buffer.
-
type
protected int type
The type of the current lexical unit.
-
previousType
protected int previousType
The previous lexical unit type that was scanned.
-
start
protected int start
The start offset of the last lexical unit.
-
end
protected int end
The end offset of the last lexical unit.
-
blankCharacters
protected int blankCharacters
The characters to skip to create the string which represents the current token.
-
-
Constructor Detail
-
AbstractScanner
public AbstractScanner(java.io.Reader r) throws ParseExceptionCreates a new AbstractScanner object.- Parameters:
r- The reader to scan.- Throws:
ParseException
-
AbstractScanner
public AbstractScanner(java.io.InputStream is, java.lang.String enc) throws ParseExceptionCreates 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
public AbstractScanner(java.lang.String s) throws ParseExceptionCreates a new AbstractScanner object.- Parameters:
s- The string to scan.- Throws:
ParseException
-
-
Method Detail
-
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
public java.lang.String getStringValue()
Returns the string representation of the current lexical unit.
-
next
public int next() throws ParseExceptionReturns the next token.- Throws:
ParseException
-
endGap
protected abstract int endGap()
Returns the end gap of the current lexical unit.
-
nextToken
protected abstract void nextToken() throws ParseExceptionReturns 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
protected int nextChar() throws java.io.IOExceptionSets the value of the current char to the next character or -1 if the end of stream has been reached.- Throws:
java.io.IOException
-
-