Package org.eclipse.angus.activation
Class MailcapTokenizer
- java.lang.Object
-
- org.eclipse.angus.activation.MailcapTokenizer
-
public class MailcapTokenizer extends java.lang.ObjectA tokenizer for strings in the form of "foo/bar; prop1=val1; ... ". Useful for parsing MIME content types.
-
-
Field Summary
Fields Modifier and Type Field Description private charautoquoteCharprivate intcurrentTokenprivate java.lang.StringcurrentTokenValueprivate java.lang.Stringdataprivate intdataIndexprivate intdataLengthstatic intEOI_TOKENstatic intEQUALS_TOKENprivate booleanisAutoquotingstatic intSEMICOLON_TOKENstatic intSLASH_TOKENstatic intSTART_TOKENstatic intSTRING_TOKENstatic intUNKNOWN_TOKEN
-
Constructor Summary
Constructors Constructor Description MailcapTokenizer(java.lang.String inputString)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringfixEscapeSequences(java.lang.String inputString)intgetCurrentToken()Retrieve current token.java.lang.StringgetCurrentTokenValue()private static booleanisControlChar(char c)private static booleanisSpecialChar(char c)private static booleanisStringTokenChar(char c)private static booleanisWhiteSpaceChar(char c)static java.lang.StringnameForToken(int token)intnextToken()private voidprocessAutoquoteToken()private voidprocessStringToken()voidsetIsAutoquoting(boolean value)Set whether auto-quoting is on or off.
-
-
-
Field Detail
-
UNKNOWN_TOKEN
public static final int UNKNOWN_TOKEN
- See Also:
- Constant Field Values
-
START_TOKEN
public static final int START_TOKEN
- See Also:
- Constant Field Values
-
STRING_TOKEN
public static final int STRING_TOKEN
- See Also:
- Constant Field Values
-
EOI_TOKEN
public static final int EOI_TOKEN
- See Also:
- Constant Field Values
-
SLASH_TOKEN
public static final int SLASH_TOKEN
- See Also:
- Constant Field Values
-
SEMICOLON_TOKEN
public static final int SEMICOLON_TOKEN
- See Also:
- Constant Field Values
-
EQUALS_TOKEN
public static final int EQUALS_TOKEN
- See Also:
- Constant Field Values
-
data
private java.lang.String data
-
dataIndex
private int dataIndex
-
dataLength
private int dataLength
-
currentToken
private int currentToken
-
currentTokenValue
private java.lang.String currentTokenValue
-
isAutoquoting
private boolean isAutoquoting
-
autoquoteChar
private char autoquoteChar
-
-
Method Detail
-
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
public static java.lang.String nameForToken(int token)
-
getCurrentTokenValue
public java.lang.String 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
private static java.lang.String fixEscapeSequences(java.lang.String inputString)
-
-