Class JavaCharStream

java.lang.Object
com.mayam.wf.attributes.shared.expr.AbstractCharStream
com.mayam.wf.attributes.shared.expr.JavaCharStream
All Implemented Interfaces:
CharStream

public class JavaCharStream extends AbstractCharStream
An implementation of interface CharStream, where the stream is assumed to contain only ASCII characters (with java-like unicode escape processing).
  • Field Details

    • NEXTCHAR_BUF_SIZE

      protected static final int NEXTCHAR_BUF_SIZE
      Predefined buffer size
      See Also:
  • Constructor Details

    • JavaCharStream

      public JavaCharStream(Provider dstream, int startline, int startcolumn, int buffersize)
      Constructor.
    • JavaCharStream

      public JavaCharStream(Provider dstream, int startline, int startcolumn)
      Constructor.
    • JavaCharStream

      public JavaCharStream(Provider dstream)
      Constructor.
  • Method Details

    • streamRead

      protected int streamRead(char[] buffer, int offset, int len) throws IOException
      Description copied from class: AbstractCharStream
      Read from the underlying stream.
      Specified by:
      streamRead in class AbstractCharStream
      Parameters:
      buffer - the buffer to be filled
      offset - The offset into the buffer. 0-based
      len - Number of chars to read.
      Returns:
      Number of effective chars read, or -1 on error.
      Throws:
      IOException
    • streamClose

      protected void streamClose() throws IOException
      Description copied from class: AbstractCharStream
      Close the underlying stream.
      Specified by:
      streamClose in class AbstractCharStream
      Throws:
      IOException - If closing fails.
    • fillBuff

      protected void fillBuff() throws IOException
      Overrides:
      fillBuff in class AbstractCharStream
      Throws:
      IOException
    • beginToken

      public char beginToken() throws IOException
      Specified by:
      beginToken in interface CharStream
      Overrides:
      beginToken in class AbstractCharStream
      Returns:
      the next character that marks the beginning of the next token. All characters must remain in the buffer between two successive calls to this method to implement backup correctly.
      Throws:
      IOException
    • readChar

      public char readChar() throws IOException
      Description copied from interface: CharStream
      Get the next character from the selected input. The method of selecting the input is the responsibility of the class implementing this interface.
      Specified by:
      readChar in interface CharStream
      Overrides:
      readChar in class AbstractCharStream
      Returns:
      the next character from the selected input
      Throws:
      IOException - on IO error
    • reInit

      public void reInit(Provider dstream)
      Reinitialise.
    • reInit

      public void reInit(Provider dstream, int startline, int startcolumn)
      Reinitialise.
    • reInit

      public void reInit(Provider dstream, int startline, int startcolumn, int buffersize)
      Reinitialise.
    • done

      public void done()
      Description copied from interface: CharStream
      The lexer calls this function to indicate that it is done with the stream and hence implementations can free any resources held by this class. Again, the body of this function can be just empty and it will not affect the lexer's operation.
      Specified by:
      done in interface CharStream
      Overrides:
      done in class AbstractCharStream