类 DelimitedLineTokenizer

  • 所有已实现的接口:
    LineTokenizer, org.springframework.beans.factory.InitializingBean

    public class DelimitedLineTokenizer
    extends AbstractLineTokenizer
    implements org.springframework.beans.factory.InitializingBean
    A LineTokenizer implementation that splits the input String on a configurable delimiter. This implementation also supports the use of an escape character to escape delimiters and line endings.
    作者:
    Rob Harrop, Dave Syer, Michael Minella
    • 字段详细资料

      • DELIMITER_TAB

        public static final java.lang.String DELIMITER_TAB
        Convenient constant for the common case of a tab delimiter.
        另请参阅:
        常量字段值
      • DELIMITER_COMMA

        public static final java.lang.String DELIMITER_COMMA
        Convenient constant for the common case of a comma delimiter.
        另请参阅:
        常量字段值
      • DEFAULT_QUOTE_CHARACTER

        public static final char DEFAULT_QUOTE_CHARACTER
        Convenient constant for the common case of a " character used to escape delimiters or line endings.
        另请参阅:
        常量字段值
    • 方法详细资料

      • setDelimiter

        public void setDelimiter​(java.lang.String delimiter)
        Setter for the delimiter character.
        参数:
        delimiter - the String used as a delimiter
      • setIncludedFields

        public void setIncludedFields​(int... includedFields)
        The fields to include in the output by position (starting at 0). By default all fields are included, but this property can be set to pick out only a few fields from a larger set. Note that if field names are provided, their number must match the number of included fields.
        参数:
        includedFields - the included fields to set
      • setQuoteCharacter

        public void setQuoteCharacter​(char quoteCharacter)
        Public setter for the quoteCharacter. The quote character can be used to extend a field across line endings or to enclose a String which contains the delimiter. Inside a quoted token the quote character can be used to escape itself, thus "a""b""c" is tokenized to a"b"c.
        参数:
        quoteCharacter - the quoteCharacter to set
        另请参阅:
        DEFAULT_QUOTE_CHARACTER
      • doTokenize

        protected java.util.List<java.lang.String> doTokenize​(java.lang.String line)
        Yields the tokens resulting from the splitting of the supplied line.
        指定者:
        doTokenize 在类中 AbstractLineTokenizer
        参数:
        line - the line to be tokenized
        返回:
        the resulting tokens
      • isQuoteCharacter

        protected boolean isQuoteCharacter​(char c)
        Is the supplied character a quote character?
        参数:
        c - the character to be checked
        返回:
        true if the supplied character is an quote character
        另请参阅:
        setQuoteCharacter(char)
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        指定者:
        afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBean
        抛出:
        java.lang.Exception