Package org.simpleframework.http.parse
Class AddressParser.Token
- java.lang.Object
-
- org.simpleframework.http.parse.AddressParser.Token
-
- Enclosing class:
- AddressParser
private class AddressParser.Token extends java.lang.ObjectThis is used as an alternative to theParseBufferfor 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 aStringobject.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateToken()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()If theTokenis to be reused this will clear all previous data.intlength()This is used to determine the number of characters this token contains.java.lang.StringtoString()This method will convert theTokeninto it'sStringequivelant.
-
-
-
Method Detail
-
clear
public void clear()
If theTokenis 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 theTokeninto it'sStringequivelant. 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 aStringand returned.- Overrides:
toStringin classjava.lang.Object- Returns:
- this returns a value representing the token
-
-