Package org.htmlunit.cssparser.parser
Class CssCharStream
java.lang.Object
org.htmlunit.cssparser.parser.CssCharStream
- All Implemented Interfaces:
CharStream
An implementation of interface CharStream.
There is no processing of escaping in this class because the escaping is
part of the parser. CSS has some strange rules about that, so processing
unicode escapes in this class is too early.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
private int[]
private char[]
private static final int
private int[]
int
Position in buffer.(package private) int
private int
private int
private Reader
private int
private int
private boolean
private boolean
static final boolean
Whether parser is static.private int
(package private) int
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionCssCharStream
(Reader dstream, int startline, int startcolumn) Constructor.CssCharStream
(Reader dstream, int startline, int startcolumn, int buffersize) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
adjustBeginLineColumn
(int newLine, int newCol) Method to adjust line and column numbers for the start of a token.final void
backup
(int amount) Backup a number of characters.final char
Start.void
Done()
Reset buffer when finished.private void
ExpandBuff
(boolean wrapAround) private final void
FillBuff()
final int
Get token beginning column number.final int
Get token beginning line number.final int
Deprecated.final int
Get token end column number.final int
Get token end line number.final String
GetImage()
Get token literal value.final int
getLine()
Deprecated.final char[]
GetSuffix
(int len) Get the suffix.int
boolean
final char
readChar()
Read a character.void
setTabSize
(int i) void
setTrackLineColumn
(boolean tlc) private final void
UpdateLineColumn
(char c)
-
Field Details
-
staticFlag
public static final boolean staticFlagWhether parser is static.- See Also:
-
BUFFER_SIZE
private static final int BUFFER_SIZE- See Also:
-
bufsize
int bufsize -
available
int available -
tokenBegin
int tokenBegin -
bufpos
public int bufposPosition in buffer. -
bufline
private int[] bufline -
bufcolumn
private int[] bufcolumn -
column
private int column -
line
private int line -
prevCharIsCR
private boolean prevCharIsCR -
prevCharIsLF
private boolean prevCharIsLF -
inputStream
-
buffer
private char[] buffer -
maxNextCharInd
private int maxNextCharInd -
inBuf
private int inBuf -
tabSize
private int tabSize -
trackLineColumn
private boolean trackLineColumn
-
-
Constructor Details
-
CssCharStream
Constructor.- Parameters:
dstream
- the stream to read fromstartline
- startlinestartcolumn
- startcolumnbuffersize
- buffersize
-
CssCharStream
Constructor.- Parameters:
dstream
- the stream to read fromstartline
- startlinestartcolumn
- startcolumn
-
-
Method Details
-
ExpandBuff
private void ExpandBuff(boolean wrapAround) -
FillBuff
- Throws:
IOException
-
BeginToken
Start.- Specified by:
BeginToken
in interfaceCharStream
- Throws:
IOException
-
UpdateLineColumn
private final void UpdateLineColumn(char c) -
readChar
Read a character.- Specified by:
readChar
in interfaceCharStream
- Throws:
IOException
-
getColumn
Deprecated.Description copied from interface:CharStream
Returns the column position of the character last read.- Specified by:
getColumn
in interfaceCharStream
- See Also:
-
getLine
Deprecated.Description copied from interface:CharStream
Returns the line number of the character last read.- Specified by:
getLine
in interfaceCharStream
- See Also:
-
getEndColumn
public final int getEndColumn()Get token end column number.- Specified by:
getEndColumn
in interfaceCharStream
-
getEndLine
public final int getEndLine()Get token end line number.- Specified by:
getEndLine
in interfaceCharStream
-
getBeginColumn
public final int getBeginColumn()Get token beginning column number.- Specified by:
getBeginColumn
in interfaceCharStream
-
getBeginLine
public final int getBeginLine()Get token beginning line number.- Specified by:
getBeginLine
in interfaceCharStream
-
backup
public final void backup(int amount) Backup a number of characters.- Specified by:
backup
in interfaceCharStream
-
GetImage
Get token literal value.- Specified by:
GetImage
in interfaceCharStream
-
GetSuffix
public final char[] GetSuffix(int len) Get the suffix.- Specified by:
GetSuffix
in interfaceCharStream
-
Done
public void Done()Reset buffer when finished.- Specified by:
Done
in interfaceCharStream
-
adjustBeginLineColumn
public void adjustBeginLineColumn(int newLine, int newCol) Method to adjust line and column numbers for the start of a token.- Parameters:
newLine
- the new linenewCol
- the new column
-
setTabSize
public void setTabSize(int i) - Specified by:
setTabSize
in interfaceCharStream
-
getTabSize
public int getTabSize()- Specified by:
getTabSize
in interfaceCharStream
-
getTrackLineColumn
public boolean getTrackLineColumn()- Specified by:
getTrackLineColumn
in interfaceCharStream
-
setTrackLineColumn
public void setTrackLineColumn(boolean tlc) - Specified by:
setTrackLineColumn
in interfaceCharStream
-