类 AbstractFileItemWriter<T>

    • 方法详细资料

      • setForceSync

        public void setForceSync​(boolean forceSync)
        Flag to indicate that changes should be force-synced to disk on flush. Defaults to false, which means that even with a local disk changes could be lost if the OS crashes in between a write and a cache flush. Setting to true may result in slower performance for usage patterns involving many frequent writes.
        参数:
        forceSync - the flag value to set
      • setLineSeparator

        public void setLineSeparator​(java.lang.String lineSeparator)
        Public setter for the line separator. Defaults to the System property line.separator.
        参数:
        lineSeparator - the line separator to set
      • setEncoding

        public void setEncoding​(java.lang.String newEncoding)
        Sets encoding for output template.
        参数:
        newEncoding - String containing the encoding to be used for the writer.
      • setShouldDeleteIfExists

        public void setShouldDeleteIfExists​(boolean shouldDeleteIfExists)
        Flag to indicate that the target file should be deleted if it already exists, otherwise it will be created. Defaults to true, so no appending except on restart. If set to false and appendAllowed is also false then there will be an exception when the stream is opened to prevent existing data being potentially corrupted.
        参数:
        shouldDeleteIfExists - the flag value to set
      • setAppendAllowed

        public void setAppendAllowed​(boolean append)
        Flag to indicate that the target file should be appended if it already exists. If this flag is set then the flag shouldDeleteIfExists is automatically set to false, so that flag should not be set explicitly. Defaults value is false.
        参数:
        append - the flag value to set
      • setShouldDeleteIfEmpty

        public void setShouldDeleteIfEmpty​(boolean shouldDeleteIfEmpty)
        Flag to indicate that the target file should be deleted if no lines have been written (other than header and footer) on close. Defaults to false.
        参数:
        shouldDeleteIfEmpty - the flag value to set
      • setSaveState

        public void setSaveState​(boolean saveState)
        Set the flag indicating whether or not state should be saved in the provided ExecutionContext during the ItemStream call to update. Setting this to false means that it will always start at the beginning on a restart.
        参数:
        saveState - if true, state will be persisted
      • setTransactional

        public void setTransactional​(boolean transactional)
        Flag to indicate that writing to the buffer should be delayed if a transaction is active. Defaults to true.
        参数:
        transactional - true if writing to buffer should be delayed.
      • write

        public void write​(java.util.List<? extends T> items)
                   throws java.lang.Exception
        Writes out a string followed by a "new line", where the format of the new line separator is determined by the underlying operating system.
        指定者:
        write 在接口中 ItemWriter<T>
        参数:
        items - list of items to be written to output stream
        抛出:
        java.lang.Exception - if an error occurs while writing items to the output stream
      • doWrite

        protected abstract java.lang.String doWrite​(java.util.List<? extends T> items)
        Write out a string of items followed by a "new line", where the format of the new line separator is determined by the underlying operating system.
        参数:
        items - to be written
        返回:
        written lines