Package jodd.lagarto
Class CharsInput
- java.lang.Object
-
- jodd.lagarto.CharsInput
-
- All Implemented Interfaces:
java.lang.CharSequence
- Direct Known Subclasses:
CharArrayInput,CharSequenceInput
abstract class CharsInput extends java.lang.Object implements java.lang.CharSequenceScanner over an input that consist of characters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCharsInput.PositionCurrent position.
-
Field Summary
Fields Modifier and Type Field Description private intlastLastNewLineOffsetprivate intlastLineprivate intlastOffsetprotected intndxCurrent position.protected inttotal
-
Constructor Summary
Constructors Constructor Description CharsInput(int total)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract charcharAtNdx()Returns character at current position.java.lang.StringdecodeHtmlName()Decodes HTML name on current position.intfind(char target)Finds a character from current position until the end of the input.intfind(char[] target, int from)Finds the char array from given index to the end of the input.intfind(char[] target, int from, int end)Finds character buffer in some range and returns its index.intfind(char target, int from, int end)Finds a character in some range and returns its index.protected booleanisEOF()Returnstrueif EOF.intlength()Returns the total size of the input.booleanmatch(char[] target)Matches char buffer with content at current location case-sensitive.protected booleanmatch(char[] target, int ndx)Matches char buffer with content on given location.booleanmatchUpperCase(char[] uppercaseTarget)Matches char buffer given in uppercase with content at current location, that will be converted to upper case to make case-insensitive matching.protected CharsInput.PositionpositionOf(int index)Calculatescurrent position: offset, line and column.
-
-
-
Method Detail
-
length
public int length()
Returns the total size of the input.- Specified by:
lengthin interfacejava.lang.CharSequence
-
charAtNdx
public abstract char charAtNdx()
Returns character at current position.
-
find
public final int find(char target)
Finds a character from current position until the end of the input.
-
find
public final int find(char target, int from, int end)Finds a character in some range and returns its index. Returns-1if character is not found.
-
find
public final int find(char[] target, int from)Finds the char array from given index to the end of the input. Returns-1if not found.
-
find
public final int find(char[] target, int from, int end)Finds character buffer in some range and returns its index. Returns-1if character is not found.
-
match
protected final boolean match(char[] target, int ndx)Matches char buffer with content on given location.
-
match
public final boolean match(char[] target)
Matches char buffer with content at current location case-sensitive.
-
matchUpperCase
public final boolean matchUpperCase(char[] uppercaseTarget)
Matches char buffer given in uppercase with content at current location, that will be converted to upper case to make case-insensitive matching.
-
decodeHtmlName
public java.lang.String decodeHtmlName()
Decodes HTML name on current position. Returnsnullif name not detected.
-
isEOF
protected final boolean isEOF()
Returnstrueif EOF.
-
positionOf
protected CharsInput.Position positionOf(int index)
Calculatescurrent position: offset, line and column.
-
-