public class ContentType extends ParameterizedArgument
| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_CHARSET
The string "charset".
|
argument, PARAMETER_SEP, TOKEN_SEPCR, currentString, HT, LF, separator, SP| Constructor and Description |
|---|
ContentType()
Empty Constructor.
|
ContentType(String mimeType)
Constructor with MIME type parameter.
|
ContentType(String mimeType,
String charset)
Constructor with MIME type and character set parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
endParse()
IS2T-API Canonises the MIME type.
|
StringBuilder |
generate(StringBuilder sb)
Appends the current character set to the
StringBuffer sb in the following form:
;charset=<character-set-string>. |
String |
getCharset()
Returns the optional charset.
|
String |
getMIMEType()
Returns the canonized MIME type (converted to lower case).
|
protected void |
initializeNbParameters(int nbParameters)
Does nothing.
|
protected void |
newParameter(int id,
int startKey,
int stopKey,
int startValue,
int stopValue)
Checks if the key value (from index startKey to index stopKey) equals to "charset" and updates the internally
stored charset to the value extracted from index startValue to index stopValue from the
CharacterSeparatedList.currentString. |
getArgument, initializeNbTokens, newTokenparse, parsepublic static final String KEY_CHARSET
public ContentType()
public ContentType(String mimeType)
mimeType - the MIME type to use for content typepublic void endParse()
At the end of the parsing, converts the MIME type to lower case and interns it.
endParse in class CharacterSeparatedListpublic StringBuilder generate(StringBuilder sb)
StringBuffer sb in the following form:
;charset=<character-set-string>.generate in class ParameterizedArgumentsb - the StringBufferStringBuffer sb.@Nullable public String getCharset()
@Nullable public String getMIMEType()
protected void initializeNbParameters(int nbParameters)
initializeNbParameters in class ParameterizedArgumentnbParameters - not used.protected void newParameter(int id,
int startKey,
int stopKey,
int startValue,
int stopValue)
CharacterSeparatedList.currentString.newParameter in class ParameterizedArgumentid - not usedstartKey - start index of keystopKey - end index of keystartValue - start index of character set substringstopValue - end index of character set substringnewParameter(int, int, int, int, int),
QualityArgument.newParameter(int, int, int, int, int)