Class StringParser


  • public class StringParser
    extends Object
    A lightweight parser custom-tailored to suit all of our supported line protocols.
    Author:
    vasily@wavefront.com
    • Constructor Detail

      • StringParser

        public StringParser​(@Nonnull
                            String input)
        Parameters:
        input - string to parse at instance creation
    • Method Detail

      • peek

        @Nullable
        public String peek()
        Retrieves the next available token, but does not advance the further, so multiple calls to peek() return the same value. The value is cached so performance penalty for multiple peek() calls is negligible.
        Returns:
        next available token or null if end of line is reached
      • hasNext

        public boolean hasNext()
        Checks whether there are more tokens available in the string.
        Returns:
        true if more tokens available
      • next

        @Nullable
        public String next()
        Retrieves the next available token and advances further.
        Returns:
        next available token or null if end of line is reached