Class Tokenizer

java.lang.Object
org.wso2.carbon.utils.Tokenizer

public class Tokenizer extends Object
Simple tokenizer class. Used to parse data. This class is taken from org.eclipse.osgi.framework.internal.core
Since:
1.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct the tokenizer from the given string.
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    Returns the next character to be processed by the tokenizer.
    getString(String terminals)
    Returns the next token delimited by any character in the provided terminals String.
    getString(String terminals, String preserveEscapes)
    Returns the next token delimited by any character in the provided terminals String.
    getToken(String terminals)
    Returns the next token delimited by any character in the provided terminals String.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Tokenizer

      public Tokenizer(String value)
      Construct the tokenizer from the given string.
      Parameters:
      value - String
  • Method Details

    • getToken

      public String getToken(String terminals)
      Returns the next token delimited by any character in the provided terminals String.
      Parameters:
      terminals - String
      Returns:
      String
    • getString

      public String getString(String terminals, String preserveEscapes)
      Returns the next token delimited by any character in the provided terminals String. If the text content being considered is within quotes, then return the entire string within quotes. If the text content within contains escape characters, preserve it if it is provided as the second parameter.
      Parameters:
      terminals - String
      preserveEscapes - String
      Returns:
      String
    • getString

      public String getString(String terminals)
      Returns the next token delimited by any character in the provided terminals String. If the text content being considered is within quotes, then return the entire string within quotes. If the text content within contains escape characters, those are ignored.
      Parameters:
      terminals - String
      Returns:
      String
    • getChar

      public char getChar()
      Returns the next character to be processed by the tokenizer.
      Returns:
      char