Class CharsInput

java.lang.Object
jodd.lagarto.CharsInput
All Implemented Interfaces:
CharSequence
Direct Known Subclasses:
CharArrayInput, CharSequenceInput

abstract class CharsInput extends Object implements CharSequence
Scanner over an input that consist of characters.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Current position.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    private int
     
    private int
     
    protected int
    Current position.
    protected final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CharsInput(int total)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract char
    Returns character at current position.
    Decodes HTML name on current position.
    final int
    find(char target)
    Finds a character from current position until the end of the input.
    final int
    find(char[] target, int from)
    Finds the char array from given index to the end of the input.
    final int
    find(char[] target, int from, int end)
    Finds character buffer in some range and returns its index.
    final int
    find(char target, int from, int end)
    Finds a character in some range and returns its index.
    protected final boolean
    Returns true if EOF.
    int
    Returns the total size of the input.
    final boolean
    match(char[] target)
    Matches char buffer with content at current location case-sensitive.
    protected final boolean
    match(char[] target, int ndx)
    Matches char buffer with content on given location.
    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.
    positionOf(int index)
    Calculates current position: offset, line and column.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface CharSequence

    charAt, chars, codePoints, getChars, isEmpty, subSequence, toString
  • Field Details

    • ndx

      protected int ndx
      Current 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:
      length in interface 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 -1 if 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 -1 if not found.
    • find

      public final int find(char[] target, int from, int end)
      Finds character buffer in some range and returns its index. Returns -1 if 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 String decodeHtmlName()
      Decodes HTML name on current position. Returns null if name not detected.
    • isEOF

      protected final boolean isEOF()
      Returns true if EOF.
    • positionOf

      protected CharsInput.Position positionOf(int index)
      Calculates current position: offset, line and column.