Class FlatFileItemReader<T>

    • Field Detail

      • DEFAULT_CHARSET

        public static final java.lang.String DEFAULT_CHARSET
      • DEFAULT_COMMENT_PREFIXES

        public static final java.lang.String[] DEFAULT_COMMENT_PREFIXES
    • Constructor Detail

      • FlatFileItemReader

        public FlatFileItemReader()
    • Method Detail

      • setSkippedLinesCallback

        public void setSkippedLinesCallback​(LineCallbackHandler skippedLinesCallback)
        Parameters:
        skippedLinesCallback - will be called for each one of the initial skipped lines before any items are read.
      • setLinesToSkip

        public void setLinesToSkip​(int linesToSkip)
        Public setter for the number of lines to skip at the start of a file. Can be used if the file contains a header without useful (column name) information, and without a comment delimiter at the beginning of the lines.
        Parameters:
        linesToSkip - the number of lines to skip
      • setLineMapper

        public void setLineMapper​(LineMapper<T> lineMapper)
        Setter for line mapper. This property is required to be set.
        Parameters:
        lineMapper - maps line to item
      • setEncoding

        public void setEncoding​(java.lang.String encoding)
        Setter for the encoding for this input source. Default value is DEFAULT_CHARSET.
        Parameters:
        encoding - a properties object which possibly contains the encoding for this input file;
      • setBufferedReaderFactory

        public void setBufferedReaderFactory​(BufferedReaderFactory bufferedReaderFactory)
        Factory for the BufferedReader that will be used to extract lines from the file. The default is fine for plain text files, but this is a useful strategy for binary files where the standard BufferedReader from java.io is limiting.
        Parameters:
        bufferedReaderFactory - the bufferedReaderFactory to set
      • setComments

        public void setComments​(java.lang.String[] comments)
        Setter for comment prefixes. Can be used to ignore header lines as well by using e.g. the first couple of column names as a prefix. Defaults to DEFAULT_COMMENT_PREFIXES.
        Parameters:
        comments - an array of comment line prefixes.
      • setRecordSeparatorPolicy

        public void setRecordSeparatorPolicy​(RecordSeparatorPolicy recordSeparatorPolicy)
        Public setter for the recordSeparatorPolicy. Used to determine where the line endings are and do things like continue over a line ending if inside a quoted string.
        Parameters:
        recordSeparatorPolicy - the recordSeparatorPolicy to set
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.Exception