java.lang.Object
io.helidon.common.http.Tokenizer
String tokenizer for parsing headers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncharconsumeCharacter(char c) Get the one character at the current position and matches it with the specified character and update the position to the next character.charconsumeCharacter(CharMatcher matcher) Get the one character at the current position and matches it with the specified matcher, then update the position to the next character.consumeToken(CharMatcher matcher) Get the token represented by the specified matcher and advance the position the to next character.consumeTokenIfPresent(CharMatcher matcher) Get the token represented by the specified matcher and advance the position the to next character if matched.booleanhasMore()Test if there are more characters to process.static Stringnormalize(CharMatcher matcher, String token) Verify that the given token matches the specified matcher and return a lower case only token string.charGet the character at the current position.
-
Constructor Details
-
Tokenizer
Create a new instance.- Parameters:
input- string to parse
-
-
Method Details
-
consumeTokenIfPresent
Get the token represented by the specified matcher and advance the position the to next character if matched.- Parameters:
matcher- matcher to use- Returns:
- token matched, or
nullif not matched - Throws:
IllegalStateException- ifhasMore()returnsfalse
-
consumeToken
Get the token represented by the specified matcher and advance the position the to next character.- Parameters:
matcher- matcher to use- Returns:
- IllegalStateException if
hasMore()returnsfalseor if the matcher wasn't matched.
-
consumeCharacter
Get the one character at the current position and matches it with the specified matcher, then update the position to the next character.- Parameters:
matcher- matcher to use- Returns:
- consumed character
- Throws:
IllegalStateException- ifhasMore()returnsfalseor if the specified matcher does not match the character at the current position
-
consumeCharacter
public char consumeCharacter(char c) Get the one character at the current position and matches it with the specified character and update the position to the next character.- Parameters:
c- character to match- Returns:
- matched character
- Throws:
IllegalStateException- ifhasMore()returnsfalseor if the specified character does not match the character at the current position
-
previewChar
public char previewChar()Get the character at the current position.- Returns:
- char
- Throws:
IllegalStateException- ifhasMore()returnsfalse
-
hasMore
public boolean hasMore()Test if there are more characters to process.- Returns:
trueif there are more characters to process,falseotherwise
-
normalize
Verify that the given token matches the specified matcher and return a lower case only token string.- Parameters:
matcher- matcher to usetoken- input token- Returns:
- normalized token string (lower case only)
-