Package org.simpleframework.http.parse
Class AddressParser.Token
java.lang.Object
org.simpleframework.http.parse.AddressParser.Token
- Enclosing class:
AddressParser
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 -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
value
This can be used to override the value for this token. -
off
public int offThis represents the start offset within the buffer. -
len
public int lenThis represents the number of charters in the token.
-
-
Constructor Details
-
Token
private Token()
-
-
Method Details
-
clear
public void clear()If theToken
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
This method will convert theToken
into it'sString
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 aString
and returned.
-