类 FixedLengthTokenizer
- java.lang.Object
- org.springframework.batch.item.file.transform.AbstractLineTokenizer
- org.springframework.batch.item.file.transform.FixedLengthTokenizer
- 所有已实现的接口:
LineTokenizer
public class FixedLengthTokenizer extends AbstractLineTokenizer
Tokenizer used to process data obtained from files with fixed-length format. Columns are specified by array of Range objects (setColumns(Range[])
).- 作者:
- tomas.slanina, peter.zozom, Dave Syer, Lucas Ward, Michael Minella
字段概要
从类继承的字段 org.springframework.batch.item.file.transform.AbstractLineTokenizer
names
构造器概要
构造器 构造器 说明 FixedLengthTokenizer()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected java.util.List<java.lang.String>
doTokenize(java.lang.String line)
Yields the tokens resulting from the splitting of the suppliedline
.void
setColumns(Range... ranges)
Set the column ranges.从类继承的方法 org.springframework.batch.item.file.transform.AbstractLineTokenizer
hasNames, isStrict, setFieldSetFactory, setNames, setStrict, tokenize
构造器详细资料
FixedLengthTokenizer
public FixedLengthTokenizer()
方法详细资料
setColumns
public void setColumns(Range... ranges)
Set the column ranges. Used in conjunction with theRangeArrayPropertyEditor
this property can be set in the form of a String describing the range boundaries, e.g. "1,4,7" or "1-3,4-6,7" or "1-2,4-5,7-10". If the last range is open then the rest of the line is read into that column (irrespective of the strict flag setting).- 参数:
ranges
- the column ranges expected in the input- 另请参阅:
AbstractLineTokenizer.setStrict(boolean)
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 (can benull
)- 返回:
- the resulting tokens (empty if the line is null)
- 抛出:
IncorrectLineLengthException
- if line length is greater than or less than the max range set.