Class PathParser.Token

  • Enclosing class:
    PathParser

    private class PathParser.Token
    extends java.lang.Object
    This is used so that the PathParser can speed up the parsing of the data. Rather than using a buffer like a ParseBuffer or worse a StringBuffer this just keeps an index into the character array from the start and end of the token. Also this enables a cache to be kept so that a String does not need to be made again after the first time it is created.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int len
      Length of the region that the token consumes.
      int off
      Offset within the buffer that the token starts.
      java.lang.String value
      Provides a quick retrieval of the token value.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Token()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      If the Token is to be reused this will clear all previous data.
      java.lang.String toString()
      This method will convert the Token into it's String equivelant.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        public java.lang.String value
        Provides a quick retrieval of the token value.
      • off

        public int off
        Offset within the buffer that the token starts.
      • len

        public int len
        Length of the region that the token consumes.
    • Constructor Detail

      • Token

        private Token()
    • Method Detail

      • clear

        public void clear()
        If the Token is to be reused this will clear all previous data. Clearing the buffer allows it to be reused if there is a new URI to be parsed. This ensures that a null is returned if the token length is zero.
      • toString

        public java.lang.String toString()
        This method will convert the Token into it's String equivelant. This will firstly check to see if there is a value, for the string representation, if there is the value is returned, otherwise the region is converted into a String and returned.
        Overrides:
        toString in class java.lang.Object
        Returns:
        this returns a value representing the token