@ConfigurationProperties(prefix="spring.batch.job.flatfileitemwriter") public class FlatFileItemWriterProperties extends Object
FlatFileItemWriter
.Constructor and Description |
---|
FlatFileItemWriterProperties() |
Modifier and Type | Method and Description |
---|---|
String |
getDelimiter()
When a file is delimited, this
String will be used as the delimiter between
fields. |
String |
getEncoding()
File encoding for the output file.
|
String |
getFormat()
Format used with the
FormatterLineAggregator . |
String |
getLineSeparator()
String used to separate lines in output.
|
Locale |
getLocale()
The
Locale used when generating the output file. |
int |
getMaximumLength()
The longest a record is allowed to be.
|
int |
getMinimumLength()
The minimum record length.
|
String |
getName()
Returns the configured value of the name used to calculate
ExecutionContext
keys. |
String[] |
getNames()
Names of the fields to be extracted into the output.
|
org.springframework.core.io.Resource |
getResource()
The output file for the
FlatFileItemWriter . |
boolean |
isAppend()
True if an output file is found and should be added onto instead of
replaced/deleted.
|
boolean |
isDelimited()
Indicates of the output will be delimited by a configured string (, by default).
|
boolean |
isForceSync()
A flag indicating that changes should be force-synced to disk on flush.
|
boolean |
isFormatted()
Indicates that the output file will use String formatting to generate the output.
|
boolean |
isSaveState()
Returns the configured value of if the state of the reader will be persisted.
|
boolean |
isShouldDeleteIfEmpty()
Indicates if the output file should be deleted if no output was written to it.
|
boolean |
isShouldDeleteIfExists()
Indicates if an existing output file should be deleted on startup.
|
boolean |
isTransactional()
Indicates if flushing the buffer should be delayed while a transaction is active.
|
void |
setAppend(boolean append)
Configure if the output file is found if it should be appended to.
|
void |
setDelimited(boolean delimited)
Configure the use of the
DelimitedLineAggregator to generate the output per
item. |
void |
setDelimiter(String delimiter)
Configure the
String used to delimit the fields in the output file. |
void |
setEncoding(String encoding)
Configure encoding of the output file.
|
void |
setForceSync(boolean forceSync)
A flag indicating that changes should be force-synced to disk on flush.
|
void |
setFormat(String format)
Configure the format the
FormatterLineAggregator will use for each item. |
void |
setFormatted(boolean formatted)
Indicates to use a
FormatterLineAggregator to generate the output per item. |
void |
setLineSeparator(String lineSeparator)
Configure the
String used to separate each line. |
void |
setLocale(Locale locale)
Configure the
Locale to use when generating the output. |
void |
setMaximumLength(int maximumLength)
Configure the maximum record length.
|
void |
setMinimumLength(int minimumLength)
Configure the minimum record length.
|
void |
setName(String name)
The name used to calculate the key within the
ExecutionContext . |
void |
setNames(String[] names)
Provide an ordered array of field names used to generate the output of a file.
|
void |
setResource(org.springframework.core.io.Resource resource)
The
Resource to be used as output. |
void |
setSaveState(boolean saveState)
Configure if the state of the
ItemStreamSupport should be persisted within
the ExecutionContext for restart purposes. |
void |
setShouldDeleteIfEmpty(boolean shouldDeleteIfEmpty)
Configure if an empty output file should be deleted once the step is complete.
|
void |
setShouldDeleteIfExists(boolean shouldDeleteIfExists)
Configures if an existing output file should be deleted on the start of the step.
|
void |
setTransactional(boolean transactional)
Configure if output should not be flushed to disk during an active transaction.
|
public boolean isSaveState()
public void setSaveState(boolean saveState)
ItemStreamSupport
should be persisted within
the ExecutionContext
for restart purposes.saveState
- defaults to truepublic String getName()
ExecutionContext
keys.public void setName(String name)
ExecutionContext
. Required if
setSaveState(boolean)
is set to true.name
- name of the reader instanceItemStreamSupport.setName(String)
public org.springframework.core.io.Resource getResource()
FlatFileItemWriter
.Resource
public void setResource(org.springframework.core.io.Resource resource)
Resource
to be used as output.resource
- the input to the reader.AbstractFileItemWriter.setResource(org.springframework.core.io.Resource)
public boolean isDelimited()
public void setDelimited(boolean delimited)
DelimitedLineAggregator
to generate the output per
item.delimited
- indicator if the file will be delimited or notpublic String getDelimiter()
String
will be used as the delimiter between
fields.public void setDelimiter(String delimiter)
String
used to delimit the fields in the output file.delimiter
- String
used to delimit the fields of the output file.public String[] getNames()
public void setNames(String[] names)
names
- An array of field namespublic boolean isAppend()
public void setAppend(boolean append)
append
- true if the output file should be appended onto if found.public boolean isFormatted()
public void setFormatted(boolean formatted)
FormatterLineAggregator
to generate the output per item.formatted
- true if the output should be formatted via the
FormatterLineAggregator
public String getEncoding()
FlatFileItemWriter.DEFAULT_CHARSET
)public void setEncoding(String encoding)
encoding
- output encodingpublic boolean isForceSync()
public void setForceSync(boolean forceSync)
forceSync
- value to set the flag topublic String getLineSeparator()
public void setLineSeparator(String lineSeparator)
String
used to separate each line.lineSeparator
- defaults to System's line.separator propertypublic boolean isShouldDeleteIfEmpty()
public void setShouldDeleteIfEmpty(boolean shouldDeleteIfEmpty)
shouldDeleteIfEmpty
- true if the file should be deleted if no items have been
written to it.public boolean isShouldDeleteIfExists()
public void setShouldDeleteIfExists(boolean shouldDeleteIfExists)
shouldDeleteIfExists
- if true and an output file of a previous run is found,
it will be deleted.public boolean isTransactional()
public void setTransactional(boolean transactional)
transactional
- defaults to truepublic String getFormat()
FormatterLineAggregator
.public void setFormat(String format)
FormatterLineAggregator
will use for each item.format
- the format for each item's output.public Locale getLocale()
Locale
used when generating the output file.Locale
. Defaults to Locale.getDefault()
public void setLocale(Locale locale)
Locale
to use when generating the output.locale
- the configured Locale
public int getMaximumLength()
public void setMaximumLength(int maximumLength)
maximumLength
- the maximum record length allowed.public int getMinimumLength()
public void setMinimumLength(int minimumLength)
minimumLength
- the minimum record length.Copyright © 2025 VMware, Inc.. All rights reserved.