Class CharsInput
java.lang.Object
jodd.lagarto.CharsInput
- All Implemented Interfaces:
CharSequence
- Direct Known Subclasses:
CharArrayInput, CharSequenceInput
Scanner over an input that consist of characters.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate intprotected intCurrent position.protected final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract charReturns character at current position.Decodes HTML name on current position.final intfind(char target) Finds a character from current position until the end of the input.final intfind(char[] target, int from) Finds the char array from given index to the end of the input.final intfind(char[] target, int from, int end) Finds character buffer in some range and returns its index.final intfind(char target, int from, int end) Finds a character in some range and returns its index.protected final booleanisEOF()Returnstrueif EOF.intlength()Returns the total size of the input.final booleanmatch(char[] target) Matches char buffer with content at current location case-sensitive.protected final booleanmatch(char[] target, int ndx) Matches char buffer with content on given location.final 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.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CharSequence
charAt, chars, codePoints, getChars, isEmpty, subSequence, toString
-
Field Details
-
ndx
protected int ndxCurrent position. -
total
protected final int total -
lastOffset
private int lastOffset -
lastLine
private int lastLine -
lastLastNewLineOffset
private int lastLastNewLineOffset
-
-
Constructor Details
-
CharsInput
public CharsInput(int total)
-
-
Method Details
-
length
public int length()Returns the total size of the input.- Specified by:
lengthin interfaceCharSequence
-
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
Decodes HTML name on current position. Returnsnullif name not detected. -
isEOF
protected final boolean isEOF()Returnstrueif EOF. -
positionOf
Calculatescurrent position: offset, line and column.
-