Package com.sun.activation.registries
Class MailcapTokenizer
java.lang.Object
com.sun.activation.registries.MailcapTokenizer
A tokenizer for strings in the form of "foo/bar; prop1=val1; ... ".
Useful for parsing MIME content types.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
fixEscapeSequences
(String inputString) int
Retrieve current token.private static boolean
isControlChar
(char c) private static boolean
isSpecialChar
(char c) private static boolean
isStringTokenChar
(char c) private static boolean
isWhiteSpaceChar
(char c) static String
nameForToken
(int token) int
private void
private void
void
setIsAutoquoting
(boolean value) Set whether auto-quoting is on or off.
-
Field Details
-
UNKNOWN_TOKEN
public static final int UNKNOWN_TOKEN- See Also:
-
START_TOKEN
public static final int START_TOKEN- See Also:
-
STRING_TOKEN
public static final int STRING_TOKEN- See Also:
-
EOI_TOKEN
public static final int EOI_TOKEN- See Also:
-
SLASH_TOKEN
public static final int SLASH_TOKEN- See Also:
-
SEMICOLON_TOKEN
public static final int SEMICOLON_TOKEN- See Also:
-
EQUALS_TOKEN
public static final int EQUALS_TOKEN- See Also:
-
data
-
dataIndex
private int dataIndex -
dataLength
private int dataLength -
currentToken
private int currentToken -
currentTokenValue
-
isAutoquoting
private boolean isAutoquoting -
autoquoteChar
private char autoquoteChar
-
-
Constructor Details
-
MailcapTokenizer
Constructor- Parameters:
inputString
- the string to tokenize
-
-
Method Details
-
setIsAutoquoting
public void setIsAutoquoting(boolean value) Set whether auto-quoting is on or off. Auto-quoting means that all characters after the first non-whitespace, non-control character up to the auto-quote terminator character or EOI (minus any whitespace immediatley preceeding it) is considered a token. This is required for handling command strings in a mailcap entry.- Parameters:
value
- on or off
-
getCurrentToken
public int getCurrentToken()Retrieve current token.- Returns:
- The current token value
-
nameForToken
-
getCurrentTokenValue
-
nextToken
public int nextToken() -
processStringToken
private void processStringToken() -
processAutoquoteToken
private void processAutoquoteToken() -
isSpecialChar
private static boolean isSpecialChar(char c) -
isControlChar
private static boolean isControlChar(char c) -
isWhiteSpaceChar
private static boolean isWhiteSpaceChar(char c) -
isStringTokenChar
private static boolean isStringTokenChar(char c) -
fixEscapeSequences
-