Package org.htmlunit.cssparser.parser
Class CssCharStream
- java.lang.Object
-
- org.htmlunit.cssparser.parser.CssCharStream
-
- All Implemented Interfaces:
CharStream
public final class CssCharStream extends java.lang.Object implements 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
Fields Modifier and Type Field Description (package private) intavailableprivate int[]bufcolumnprivate char[]bufferprivate static intBUFFER_SIZEprivate int[]buflineintbufposPosition in buffer.(package private) intbufsizeprivate intcolumnprivate intinBufprivate java.io.ReaderinputStreamprivate intlineprivate intmaxNextCharIndprivate booleanprevCharIsCRprivate booleanprevCharIsLFstatic booleanstaticFlagWhether parser is static.private inttabSize(package private) inttokenBeginprivate booleantrackLineColumn
-
Constructor Summary
Constructors Constructor Description CssCharStream(java.io.Reader dstream, int startline, int startcolumn)Constructor.CssCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadjustBeginLineColumn(int newLine, int newCol)Method to adjust line and column numbers for the start of a token.voidbackup(int amount)Backup a number of characters.charBeginToken()Start.voidDone()Reset buffer when finished.private voidExpandBuff(boolean wrapAround)private voidFillBuff()intgetBeginColumn()Get token beginning column number.intgetBeginLine()Get token beginning line number.intgetColumn()Deprecated.intgetEndColumn()Get token end column number.intgetEndLine()Get token end line number.java.lang.StringGetImage()Get token literal value.intgetLine()Deprecated.char[]GetSuffix(int len)Get the suffix.intgetTabSize()booleangetTrackLineColumn()charreadChar()Read a character.voidsetTabSize(int i)voidsetTrackLineColumn(boolean tlc)private voidUpdateLineColumn(char c)
-
-
-
Field Detail
-
staticFlag
public static final boolean staticFlag
Whether parser is static.- See Also:
- Constant Field Values
-
BUFFER_SIZE
private static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
bufsize
int bufsize
-
available
int available
-
tokenBegin
int tokenBegin
-
bufpos
public int bufpos
Position 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
private java.io.Reader inputStream
-
buffer
private char[] buffer
-
maxNextCharInd
private int maxNextCharInd
-
inBuf
private int inBuf
-
tabSize
private int tabSize
-
trackLineColumn
private boolean trackLineColumn
-
-
Constructor Detail
-
CssCharStream
public CssCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize)Constructor.- Parameters:
dstream- the stream to read fromstartline- startlinestartcolumn- startcolumnbuffersize- buffersize
-
CssCharStream
public CssCharStream(java.io.Reader dstream, int startline, int startcolumn)Constructor.- Parameters:
dstream- the stream to read fromstartline- startlinestartcolumn- startcolumn
-
-
Method Detail
-
ExpandBuff
private void ExpandBuff(boolean wrapAround)
-
FillBuff
private final void FillBuff() throws java.io.IOException- Throws:
java.io.IOException
-
BeginToken
public final char BeginToken() throws java.io.IOExceptionStart.- Specified by:
BeginTokenin interfaceCharStream- Throws:
java.io.IOException
-
UpdateLineColumn
private final void UpdateLineColumn(char c)
-
readChar
public final char readChar() throws java.io.IOExceptionRead a character.- Specified by:
readCharin interfaceCharStream- Throws:
java.io.IOException
-
getColumn
@Deprecated public final int getColumn()
Deprecated.Description copied from interface:CharStreamReturns the column position of the character last read.- Specified by:
getColumnin interfaceCharStream- See Also:
CharStream.getEndColumn()
-
getLine
@Deprecated public final int getLine()
Deprecated.Description copied from interface:CharStreamReturns the line number of the character last read.- Specified by:
getLinein interfaceCharStream- See Also:
CharStream.getEndLine()
-
getEndColumn
public final int getEndColumn()
Get token end column number.- Specified by:
getEndColumnin interfaceCharStream
-
getEndLine
public final int getEndLine()
Get token end line number.- Specified by:
getEndLinein interfaceCharStream
-
getBeginColumn
public final int getBeginColumn()
Get token beginning column number.- Specified by:
getBeginColumnin interfaceCharStream
-
getBeginLine
public final int getBeginLine()
Get token beginning line number.- Specified by:
getBeginLinein interfaceCharStream
-
backup
public final void backup(int amount)
Backup a number of characters.- Specified by:
backupin interfaceCharStream
-
GetImage
public final java.lang.String GetImage()
Get token literal value.- Specified by:
GetImagein interfaceCharStream
-
GetSuffix
public final char[] GetSuffix(int len)
Get the suffix.- Specified by:
GetSuffixin interfaceCharStream
-
Done
public void Done()
Reset buffer when finished.- Specified by:
Donein 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:
setTabSizein interfaceCharStream
-
getTabSize
public int getTabSize()
- Specified by:
getTabSizein interfaceCharStream
-
getTrackLineColumn
public boolean getTrackLineColumn()
- Specified by:
getTrackLineColumnin interfaceCharStream
-
setTrackLineColumn
public void setTrackLineColumn(boolean tlc)
- Specified by:
setTrackLineColumnin interfaceCharStream
-
-