org.springframework.batch.item.file.transform
Class FixedLengthTokenizer
java.lang.Object
   org.springframework.batch.item.file.transform.AbstractLineTokenizer
org.springframework.batch.item.file.transform.AbstractLineTokenizer
       org.springframework.batch.item.file.transform.FixedLengthTokenizer
org.springframework.batch.item.file.transform.FixedLengthTokenizer
- All Implemented Interfaces: 
- 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[])
 ).
- Author:
- tomas.slanina, peter.zozom, Dave Syer, Lucas Ward
 
 
 
| Method Summary | 
| protected  List | doTokenize(String line)Yields the tokens resulting from the splitting of the supplied
 line. | 
|  void | setColumns(Range[] ranges)Set the column ranges.
 | 
|  void | setStrict(boolean strict)Public setter for the strict flag.
 | 
 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
FixedLengthTokenizer
public FixedLengthTokenizer()
setStrict
public void setStrict(boolean strict)
- Public setter for the strict flag. If true (the default) then lines must
 be precisely the length specified by the columns. If false then shorter
 lines will be tolerated and padded with empty columns, and longer strings
 will simply be truncated.
 
- 
- Parameters:
- strict- the strict to set
- See Also:
- setColumns(Range[])
 
setColumns
public void setColumns(Range[] ranges)
- Set the column ranges. Used in conjunction with the
 RangeArrayPropertyEditorthis 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).
 
- 
- Parameters:
- ranges- the column ranges expected in the input
- See Also:
- setStrict(boolean)
 
doTokenize
protected List doTokenize(String line)
- Yields the tokens resulting from the splitting of the supplied
 line.
 
- 
- Specified by:
- doTokenizein class- AbstractLineTokenizer
 
- 
- Parameters:
- line- the line to be tokenised (can be- null)
- Returns:
- the resulting tokens (empty if the line is null)
- Throws:
- IncorrectLineLengthException- if line length is greater than or
 less than the max range set.
 
Copyright © 2009 SpringSource. All Rights Reserved.