org.springframework.batch.item.file.separator
Interface RecordSeparatorPolicy

All Known Implementing Classes:
DefaultRecordSeparatorPolicy, SimpleRecordSeparatorPolicy, SuffixRecordSeparatorPolicy

public interface RecordSeparatorPolicy

Policy for text file-based input sources to determine the end of a record, e.g. a record might be a single line, or it might be multiple lines terminated by a semicolon.

Author:
Dave Syer

Method Summary
 boolean isEndOfRecord(String line)
          Signal the end of a record based on the content of a line, being the latest line read from an input source.
 String postProcess(String record)
          Give the policy a chance to post-process a complete record, e.g.
 String preProcess(String record)
          Pre-process a record before another line is appended, in the case of a multi-line record.
 

Method Detail

isEndOfRecord

boolean isEndOfRecord(String line)
Signal the end of a record based on the content of a line, being the latest line read from an input source. The input is what you would expect from BufferedReader.readLine() - i.e. no line separator character at the end. But it might have line separators embedded in it.

Parameters:
line - a String without a newline character at the end.
Returns:
true if this line is the end of a record.

postProcess

String postProcess(String record)
Give the policy a chance to post-process a complete record, e.g. remove a suffix.

Parameters:
record - the complete record.
Returns:
a modified version of the record if desired.

preProcess

String preProcess(String record)
Pre-process a record before another line is appended, in the case of a multi-line record. Can be used to remove a prefix or line-continuation marker. If a record is a single line this callback is not used (but postProcess(String) will be).

Parameters:
record - the current record.
Returns:
the line as it should be appended to a record.


Copyright © 2008 SpringSource. All Rights Reserved.