Interface TokenControl


public interface TokenControl
Offers methods to control the parsing process by the handler.
  • Method Details

    • enableAllComments

      void enableAllComments()
      Enable the handling of all types of comments.
    • setAcceptNewlineEndingQuote

      void setAcceptNewlineEndingQuote(boolean accept)
      If set, quoted strings ending with an unescaped newline (instead of the closing quote) are processed through the relevant quoted method, albeit an error is reported in any case. Otherwise, only the error is reported.

      It is set to false by default.

      Parameters:
      accept - true to process quoted strings that ends with an unescaped newline, false otherwise.
    • setAcceptEofEndingQuoted

      void setAcceptEofEndingQuoted(boolean accept)
      If set, quoted strings ending with an EOF (End Of File). are processed through the relevant quoted method, albeit an error is reported in any case. Otherwise, only the error is reported.

      It is set to false by default.

      Parameters:
      accept - true to process quoted strings that ends with an EOF, false otherwise.
    • skipNextCodepoint

      int skipNextCodepoint() throws IOException
      Gives the next code point in the stream, bypassing the general processing for that one.
      Returns:
      the next code point, or -1 if the end of the stream was reached.
      Throws:
      IOException - if an I/O problem occurs.
    • getContentHandler

      ContentHandler<?> getContentHandler()
      Get the current content handler.
      Returns:
      the ContentHandler.
    • setContentHandler

      void setContentHandler(ContentHandler<?> handler)
      Set a new ContentHandler.
      Parameters:
      handler - the new ContentHandler.
    • getControlHandler

      ControlHandler<?> getControlHandler()
      Get the current control handler.
      Returns:
      the ControlHandler.
    • setControlHandler

      void setControlHandler(ControlHandler<?> handler)
      Set a new ControlHandler.
      Parameters:
      handler - the new ControlHandler.
    • getErrorHandler

      TokenErrorHandler<?> getErrorHandler()
      Get the current error handler.
      Returns:
      the TokenErrorHandler.
    • setErrorHandler

      void setErrorHandler(TokenErrorHandler<?> handler)
      Set a new TokenErrorHandler.
      Parameters:
      handler - the new TokenErrorHandler.
    • getTokenHandler

      @Deprecated default TokenHandler3<?> getTokenHandler()
      Get the current content handler, assuming that it implements the TokenHandler3 interface.

      This method is present only for backwards compatibility. Please avoid it, as the content handler may or may not implement the legacy TokenHandler3 interface.

      Returns:
      the TokenHandler.
    • setTokenHandler

      void setTokenHandler(TokenHandler3<?> handler)
      Set all the handlers with a new TokenHandler3.
      Parameters:
      handler - the new TokenHandler3.
    • disableAllComments

      void disableAllComments()
      Disable the handling of all types of comments.
    • enableComments

      void enableComments(int type)
      Enable the handling of comments of the given type.
      Parameters:
      type - the type of comment to enable. If the type does not exist, implementations may or may not throw an exception, depending on the intended coupling with the TokenHandler.
    • disableComments

      void disableComments(int type)
      Disable the handling of comments of the given type.
      Parameters:
      type - the type of comment to disable. If the type does not exist, implementations may or may not throw an exception, depending on the intended coupling with the TokenHandler.
    • setExternalLocationHandling

      void setExternalLocationHandling(boolean enable)
      Enable/disable the external handling of locations.

      If a binary stream is being processed, it should be enabled. It is enabled by default.

      Parameters:
      enable - if false, this parser will take care of handling CR/LF/FF control characters and location housekeeping. Otherwise, all control characters are sent to the handler without further processing.
    • setLocationTo

      void setLocationTo(LocatorAccess locator)
      Set the current parsing location to the given locator.

      Will only work correctly if externalLocationHandling is disabled.

      Parameters:
      locator - the locator.
      See Also:
    • setLocationTo

      void setLocationTo(LocatorAccess locator, int index)
      Set the parsing location given by index to the given locator.

      Will only work correctly if externalLocationHandling is disabled and the index points at the same line that the current parsing location.

      Parameters:
      locator - the locator.
      index - the index at which the location is to be set.
      See Also: