Class AddressParser.Token

java.lang.Object
org.simpleframework.http.parse.AddressParser.Token
Enclosing class:
AddressParser

private class AddressParser.Token extends 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
    This represents the number of charters in the token.
    int
    This represents the start offset within the buffer.
    This can be used to override the value for this token.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    If the Token is to be reused this will clear all previous data.
    int
    This is used to determine the number of characters this token contains.
    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 Details

    • value

      public 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 Details

    • Token

      private Token()
  • Method Details

    • 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 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 Object
      Returns:
      this returns a value representing the token