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.Object
This is used as an alternative to theParseBuffer
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 aString
object.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Token()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
If theToken
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 theToken
into it'sString
equivelant.
-
-
-
Method Detail
-
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
public java.lang.String 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.- Overrides:
toString
in classjava.lang.Object
- Returns:
- this returns a value representing the token
-
-