Class AddressParser.Token

  • Enclosing class:
    AddressParser

    private class AddressParser.Token
    extends java.lang.Object
    This is used as an alternative to the ParseBuffer for extracting tokens from the URI without allocating memory. This will basically mark out regions within the buffer which are used to represent the token. When the token value is required the region is used to create a String object.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int len
      This represents the number of charters in the token.
      int off
      This represents the start offset within the buffer.
      java.lang.String value
      This can be used to override the value for this token.
    • 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.
      int length()
      This is used to determine the number of characters this token contains.
      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
        This can be used to override the value for this token.
      • off

        public int off
        This represents the start offset within the buffer.
      • len

        public int len
        This represents the number of charters in the token.
    • 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.
      • length

        public int length()
        This is used to determine the number of characters this token contains. This is used rather than accessing the length directly so that the value the token represents can be overridden easily without upsetting the token.
        Returns:
        this returns the number of characters this uses
      • 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