Package ej.hoka.http.support
Class CharacterSeparatedList
- java.lang.Object
-
- ej.hoka.http.support.CharacterSeparatedList
-
- Direct Known Subclasses:
AcceptEncoding,ParameterizedArgument
public abstract class CharacterSeparatedList extends Object
Abstract class for implementing parsers for character separated lists.
-
-
Field Summary
Fields Modifier and Type Field Description protected static charCRCarriage Return character.protected StringcurrentStringCurrent string being parsed.protected static charHTHorizontal TAB character.protected static charLFLine feed character.protected charseparatorCharacters separator.protected static charSPSpace character.
-
Constructor Summary
Constructors Constructor Description CharacterSeparatedList(char separator)Creates a new instance ofCharacterSeparatedListusing the characterseparatoras the separator character.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidendParse()End instructions of the string parsing.protected abstract StringBuildergenerate(StringBuilder sb)Generates a String representation.protected abstract voidinitializeNbTokens(int nbTokens)Set the number of tokens to read.protected abstract voidnewToken(int id, int start, int stop)Read a new token between the given start and stop index and set its id.voidparse(String str)Parses the givenString.voidparse(String str, int start, int stop)
-
-
-
Field Detail
-
CR
protected static final char CR
Carriage Return character.- See Also:
- Constant Field Values
-
HT
protected static final char HT
Horizontal TAB character.- See Also:
- Constant Field Values
-
LF
protected static final char LF
Line feed character.- See Also:
- Constant Field Values
-
SP
protected static final char SP
Space character.- See Also:
- Constant Field Values
-
separator
protected char separator
Characters separator.
-
-
Constructor Detail
-
CharacterSeparatedList
public CharacterSeparatedList(char separator)
Creates a new instance ofCharacterSeparatedListusing the characterseparatoras the separator character.- Parameters:
separator- the character to treat as characters separator for this list
-
-
Method Detail
-
endParse
protected void endParse()
End instructions of the string parsing.
-
generate
protected abstract StringBuilder generate(StringBuilder sb)
Generates a String representation.- Parameters:
sb- theStringBuffer- Returns:
StringBuffer
-
initializeNbTokens
protected abstract void initializeNbTokens(int nbTokens)
Set the number of tokens to read.- Parameters:
nbTokens- number of tokens
-
newToken
protected abstract void newToken(int id, int start, int stop)Read a new token between the given start and stop index and set its id.- Parameters:
id- for the tokenstart- index of the token begin in the stringstop- index of the token end in the string
-
-