Class MailcapTokenizer


  • public class MailcapTokenizer
    extends java.lang.Object
    A tokenizer for strings in the form of "foo/bar; prop1=val1; ... ". Useful for parsing MIME content types.
    • Field Detail

      • 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
    • Constructor Detail

      • MailcapTokenizer

        public MailcapTokenizer​(java.lang.String inputString)
        Constructor
        Parameters:
        inputString - the string to tokenize
    • 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)