Package com.redis.riot.core.resource
Class AbstractResourceItemWriter.OutputState
- java.lang.Object
-
- com.redis.riot.core.resource.AbstractResourceItemWriter.OutputState
-
- Enclosing class:
- AbstractResourceItemWriter<T>
protected class AbstractResourceItemWriter.OutputState extends java.lang.Object
Encapsulates the runtime state of the writer. All state changing operations on the writer go through this class.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
OutputState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the open resource and reset counters.long
getLinesWritten()
boolean
isInitialized()
long
position()
void
restoreFrom(org.springframework.batch.item.ExecutionContext executionContext)
void
setAppendAllowed(boolean append)
void
setDeleteIfExists(boolean shouldDeleteIfExists)
void
setEncoding(java.lang.String encoding)
void
setLinesWritten(long linesWritten)
void
write(java.lang.String line)
-
-
-
Method Detail
-
position
public long position() throws java.io.IOException
- Returns:
- byte offset position of the cursor in the output file as a long
- Throws:
java.io.IOException
- If unable to get the offset position
-
setAppendAllowed
public void setAppendAllowed(boolean append)
- Parameters:
append
- if true, append to previously created file
-
restoreFrom
public void restoreFrom(org.springframework.batch.item.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
- If unable to write the String to the file
-
isInitialized
public boolean isInitialized()
-
-