Class AbstractFileItemWriter.OutputState
- java.lang.Object
- org.springframework.batch.item.support.AbstractFileItemWriter.OutputState
- Enclosing class:
- AbstractFileItemWriter<T>
protected class AbstractFileItemWriter.OutputState extends java.lang.ObjectEncapsulates the runtime state of the writer. All state changing operations on the writer go through this class.
Constructor Summary
Constructors Modifier Constructor Description protectedOutputState()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the open resource and reset counters.longgetLinesWritten()booleanisInitialized()longposition()Return the byte offset position of the cursor in the output file as a long integer.voidrestoreFrom(ExecutionContext executionContext)voidsetAppendAllowed(boolean append)voidsetDeleteIfExists(boolean shouldDeleteIfExists)voidsetEncoding(java.lang.String encoding)voidsetLinesWritten(long linesWritten)voidtruncate()Truncate the output at the last known good point.voidwrite(java.lang.String line)
Method Detail
position
public long position() throws java.io.IOExceptionReturn the byte offset position of the cursor in the output file as a long integer.- Throws:
java.io.IOException
setAppendAllowed
public void setAppendAllowed(boolean append)
- Parameters:
append- if true, append to previously created file
restoreFrom
public void restoreFrom(ExecutionContext executionContext)
- Parameters:
executionContext- state from which to restore writing from
setDeleteIfExists
public void setDeleteIfExists(boolean shouldDeleteIfExists)
- Parameters:
shouldDeleteIfExists- indicator
setEncoding
public void setEncoding(java.lang.String encoding)
- Parameters:
encoding- file encoding
getLinesWritten
public long getLinesWritten()
setLinesWritten
public void setLinesWritten(long linesWritten)
close
public void close()
Close the open resource and reset counters.
write
public void write(java.lang.String line) throws java.io.IOException- Parameters:
line- String to be written to the file- Throws:
java.io.IOException
truncate
public void truncate() throws java.io.IOExceptionTruncate the output at the last known good point.- Throws:
java.io.IOException- if unable to work with file
isInitialized
public boolean isInitialized()