Class AtomicFiles
java.lang.Object
org.spongepowered.configurate.loader.AtomicFiles
A utility for creating "atomic" file writers.
An atomic writer copies any existing file at the given path to a temporary location, then writes to the same temporary location, before moving the file back to the desired output path once the write is fully complete.
- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedWriter
atomicBufferedWriter
(Path path, Charset charset) Creates and returns an "atomic" writer for the given path.static Callable<BufferedWriter>
atomicWriterFactory
(Path path, Charset charset) Creates and returns an "atomic" writer factory for the given path.
-
Method Details
-
atomicWriterFactory
Creates and returns an "atomic" writer factory for the given path.- Parameters:
path
- path the complete file should be written tocharset
- the charset to be used by the writer- Returns:
- a new writer factory
- Since:
- 4.0.0
-
atomicBufferedWriter
Creates and returns an "atomic" writer for the given path.- Parameters:
path
- the pathcharset
- the charset to be used by the writer- Returns:
- a new writer factory
- Throws:
IOException
- for any underlying filesystem errors- Since:
- 4.0.0
-