Class PathParser.Token

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

private class PathParser.Token extends 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
    Length of the region that the token consumes.
    int
    Offset within the buffer that the token starts.
    Provides a quick retrieval of the token value.
  • 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.
    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
      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 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.
    • 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