Package org.simpleframework.http.message
Class SegmentConsumer.Token
- java.lang.Object
-
- org.simpleframework.http.message.SegmentConsumer.Token
-
- Enclosing class:
- SegmentConsumer
private class SegmentConsumer.Token extends java.lang.Object
This is used to track the boundaries of a token so that it can be converted in to a usable string. This will track the length and offset within the consumed array of the token. When the token is to be used it can be converted in to a string.
-
-
Constructor Summary
Constructors Constructor Description Token(int off, int size)
Constructor for theToken
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
text()
This is used to convert the byte range to a string.java.lang.String
text(java.lang.String charset)
This is used to convert the byte range to a string.
-
-
-
Constructor Detail
-
Token
public Token(int off, int size)
Constructor for theToken
object. This is used to create a new token to track the range of bytes that will be used to create a string representing the parsed value.- Parameters:
off
- the starting offset for the token rangesize
- the number of bytes used for the token
-
-
Method Detail
-
text
public java.lang.String text()
This is used to convert the byte range to a string. This will use UTF-8 encoding for the string which is compatible with the HTTP default header encoding of ISO-8859-1.- Returns:
- the encoded string representing the token
-
text
public java.lang.String text(java.lang.String charset)
This is used to convert the byte range to a string. This will use specified encoding, if that encoding is not supported then this will return null for the token value.- Returns:
- the encoded string representing the token
-
-