类 DelimitedLineTokenizer
- java.lang.Object
- org.springframework.batch.item.file.transform.AbstractLineTokenizer
- org.springframework.batch.item.file.transform.DelimitedLineTokenizer
- 所有已实现的接口:
LineTokenizer,org.springframework.beans.factory.InitializingBean
public class DelimitedLineTokenizer extends AbstractLineTokenizer implements org.springframework.beans.factory.InitializingBean
ALineTokenizerimplementation 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
字段概要
字段 修饰符和类型 字段 说明 static charDEFAULT_QUOTE_CHARACTERConvenient constant for the common case of a " character used to escape delimiters or line endings.static java.lang.StringDELIMITER_COMMAConvenient constant for the common case of a comma delimiter.static java.lang.StringDELIMITER_TABConvenient constant for the common case of a tab delimiter.从类继承的字段 org.springframework.batch.item.file.transform.AbstractLineTokenizer
names
构造器概要
构造器 构造器 说明 DelimitedLineTokenizer()Create a new instance of theDelimitedLineTokenizerclass for the common case where the delimiter is acomma.DelimitedLineTokenizer(java.lang.String delimiter)Create a new instance of theDelimitedLineTokenizerclass.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidafterPropertiesSet()protected java.util.List<java.lang.String>doTokenize(java.lang.String line)Yields the tokens resulting from the splitting of the suppliedline.protected booleanisQuoteCharacter(char c)Is the supplied character a quote character?voidsetDelimiter(java.lang.String delimiter)Setter for the delimiter character.voidsetIncludedFields(int... includedFields)The fields to include in the output by position (starting at 0).voidsetQuoteCharacter(char quoteCharacter)Public setter for the quoteCharacter.从类继承的方法 org.springframework.batch.item.file.transform.AbstractLineTokenizer
hasNames, isStrict, setFieldSetFactory, setNames, setStrict, tokenize
字段详细资料
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.- 另请参阅:
- 常量字段值
构造器详细资料
DelimitedLineTokenizer
public DelimitedLineTokenizer()
Create a new instance of theDelimitedLineTokenizerclass for the common case where the delimiter is acomma.
DelimitedLineTokenizer
public DelimitedLineTokenizer(java.lang.String delimiter)
Create a new instance of theDelimitedLineTokenizerclass.- 参数:
delimiter- the desired delimiter. This is required
方法详细资料
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 suppliedline.- 指定者:
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- 返回:
trueif 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