Package jodd.lagarto

Class CharsInput

  • All Implemented Interfaces:
    java.lang.CharSequence
    Direct Known Subclasses:
    CharArrayInput, CharSequenceInput

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

      Nested Classes 
      Modifier and Type Class Description
      static class  CharsInput.Position
      Current position.
    • Constructor Summary

      Constructors 
      Constructor Description
      CharsInput​(int total)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract char charAtNdx()
      Returns character at current position.
      java.lang.String decodeHtmlName()
      Decodes HTML name on current position.
      int find​(char target)
      Finds a character from current position until the end of the input.
      int find​(char[] target, int from)
      Finds the char array from given index to the end of the input.
      int find​(char[] target, int from, int end)
      Finds character buffer in some range and returns its index.
      int find​(char target, int from, int end)
      Finds a character in some range and returns its index.
      protected boolean isEOF()
      Returns true if EOF.
      int length()
      Returns the total size of the input.
      boolean match​(char[] target)
      Matches char buffer with content at current location case-sensitive.
      protected boolean match​(char[] target, int ndx)
      Matches char buffer with content on given location.
      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.
      protected CharsInput.Position positionOf​(int index)
      Calculates current position: offset, line and column.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.CharSequence

        charAt, chars, codePoints, subSequence, toString
    • Field Detail

      • ndx

        protected int ndx
        Current position.
      • total

        protected final int total
      • lastOffset

        private int lastOffset
      • lastLine

        private int lastLine
      • lastLastNewLineOffset

        private int lastLastNewLineOffset
    • Constructor Detail

      • CharsInput

        public CharsInput​(int total)
    • Method Detail

      • length

        public int length()
        Returns the total size of the input.
        Specified by:
        length in interface java.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 -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 java.lang.String decodeHtmlName()
        Decodes HTML name on current position. Returns null if name not detected.
      • isEOF

        protected final boolean isEOF()
        Returns true if EOF.