Class SuffixRecordSeparatorPolicy
java.lang.Object
org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy
org.springframework.batch.item.file.separator.DefaultRecordSeparatorPolicy
org.springframework.batch.item.file.separator.SuffixRecordSeparatorPolicy
- All Implemented Interfaces:
RecordSeparatorPolicy
A
RecordSeparatorPolicy
that looks for an exact match for a String at the end
of a line (e.g. a semicolon).- Author:
- Dave Syer
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isEndOfRecord
(String line) Return true if the line ends with the specified substring.postProcess
(String record) Remove the suffix from the end of the record.void
setIgnoreWhitespace
(boolean ignoreWhitespace) Flag to indicate that the decision to terminate a record should ignore whitespace at the end of the line.void
Lines ending in this terminator String signal the end of a record.Methods inherited from class org.springframework.batch.item.file.separator.DefaultRecordSeparatorPolicy
preProcess, setContinuation, setQuoteCharacter
-
Field Details
-
DEFAULT_SUFFIX
Default value for record terminator suffix.- See Also:
-
-
Constructor Details
-
SuffixRecordSeparatorPolicy
public SuffixRecordSeparatorPolicy()
-
-
Method Details
-
setSuffix
Lines ending in this terminator String signal the end of a record.- Parameters:
suffix
- suffix to indicate the end of a record
-
setIgnoreWhitespace
public void setIgnoreWhitespace(boolean ignoreWhitespace) Flag to indicate that the decision to terminate a record should ignore whitespace at the end of the line.- Parameters:
ignoreWhitespace
- indicator
-
isEndOfRecord
Return true if the line ends with the specified substring. By default whitespace is trimmed before the comparison. Also returns true if the line is null, but not if it is empty.- Specified by:
isEndOfRecord
in interfaceRecordSeparatorPolicy
- Overrides:
isEndOfRecord
in classDefaultRecordSeparatorPolicy
- Parameters:
line
- a String without a newline character at the end.- Returns:
- true if this line is a complete record.
- See Also:
-
postProcess
Remove the suffix from the end of the record.- Specified by:
postProcess
in interfaceRecordSeparatorPolicy
- Overrides:
postProcess
in classSimpleRecordSeparatorPolicy
- Parameters:
record
- the complete record.- Returns:
- a modified version of the record if desired.
- See Also:
-