Package monq.jfa

Class StringCharSource

java.lang.Object
monq.jfa.StringCharSource
All Implemented Interfaces:
CharSource

public class StringCharSource extends Object implements CharSource
A CharSource for a String or a part of it.
  • Constructor Details

    • StringCharSource

      public StringCharSource(String text)
    • StringCharSource

      public StringCharSource(String text, int start, int length)
  • Method Details

    • read

      public int read() throws IOException
      Description copied from interface: CharSource
      returns a single character or -1 to indicate end of file.
      Specified by:
      read in interface CharSource
      Throws:
      IOException
    • mark

      public void mark()
      Description copied from interface: CharSource
      Sets a mark until which we may want to skip back with CharSource.backToMark() to re-read part of the input. The initial mark is always at the start of the input, so that after a call to backToMark the whole CharSource can be re-read.
      Specified by:
      mark in interface CharSource
    • backToMark

      public int backToMark()
      Description copied from interface: CharSource
      Resets this to a previously set CharSource.mark().
      Specified by:
      backToMark in interface CharSource