Package org.springframework.batch.item.file.separator

# 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`

public class SuffixRecordSeparatorPolicy extends DefaultRecordSeparatorPolicy
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

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DEFAULT_SUFFIX`
  Default value for record terminator suffix.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SuffixRecordSeparatorPolicy()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isEndOfRecord(String line)`
  Return true if the line ends with the specified substring.
  `String`
  `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`
  `setSuffix(String suffix)`
  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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_SUFFIX

    public static final String DEFAULT_SUFFIX
    Default value for record terminator suffix.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SuffixRecordSeparatorPolicy

    public SuffixRecordSeparatorPolicy()

- ## Method Details

  - ### setSuffix

    public void setSuffix(String suffix)
    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

    public boolean isEndOfRecord(String line)
    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 interface `RecordSeparatorPolicy`
    Overrides:
      `isEndOfRecord` in class `DefaultRecordSeparatorPolicy`
    Parameters:
      `line` - a String without a newline character at the end.
    Returns:
      true if this line is a complete record.
    See Also:
      - `RecordSeparatorPolicy.isEndOfRecord(java.lang.String)`

  - ### postProcess

    public String postProcess(String record)
    Remove the suffix from the end of the record.
    Specified by:
      `postProcess` in interface `RecordSeparatorPolicy`
    Overrides:
      `postProcess` in class `SimpleRecordSeparatorPolicy`
    Parameters:
      `record` - the complete record.
    Returns:
      a modified version of the record if desired.
    See Also:
      - `SimpleRecordSeparatorPolicy.postProcess(java.lang.String)`