类 AbstractFileItemWriter.OutputState
- java.lang.Object
- org.springframework.batch.item.support.AbstractFileItemWriter.OutputState
- 封闭类:
- AbstractFileItemWriter<T>
protected class AbstractFileItemWriter.OutputState extends java.lang.Object
Encapsulates the runtime state of the writer. All state changing operations on the writer go through this class.
构造器概要
构造器 限定符 构造器 说明 protected
OutputState()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
close()
Close the open resource and reset counters.long
getLinesWritten()
boolean
isInitialized()
long
position()
Return the byte offset position of the cursor in the output file as a long integer.void
restoreFrom(ExecutionContext executionContext)
void
setAppendAllowed(boolean append)
void
setDeleteIfExists(boolean shouldDeleteIfExists)
void
setEncoding(java.lang.String encoding)
void
setLinesWritten(long linesWritten)
void
truncate()
Truncate the output at the last known good point.void
write(java.lang.String line)
构造器详细资料
OutputState
protected OutputState()
方法详细资料
position
public long position() throws java.io.IOException
Return the byte offset position of the cursor in the output file as a long integer.- 抛出:
java.io.IOException
setAppendAllowed
public void setAppendAllowed(boolean append)
- 参数:
append
- if true, append to previously created file
restoreFrom
public void restoreFrom(ExecutionContext executionContext)
- 参数:
executionContext
- state from which to restore writing from
setDeleteIfExists
public void setDeleteIfExists(boolean shouldDeleteIfExists)
- 参数:
shouldDeleteIfExists
- indicator
setEncoding
public void setEncoding(java.lang.String encoding)
- 参数:
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
- 参数:
line
- String to be written to the file- 抛出:
java.io.IOException
truncate
public void truncate() throws java.io.IOException
Truncate the output at the last known good point.- 抛出:
java.io.IOException
- if unable to work with file
isInitialized
public boolean isInitialized()