public class AtomicFileWriter extends Writer
FileWriter
that uses UTF-8.
The write operation is atomic when used for overwriting; it either leaves the original file intact, or it completely rewrites it with new contents.
Constructor and Description |
---|
AtomicFileWriter(File f) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
commit() |
void |
flush() |
File |
getTemporaryFile()
Until the data is committed, this file captures
the written content.
|
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int c) |
void |
write(String str,
int off,
int len) |
public AtomicFileWriter(File f) throws IOException
IOException
public void write(int c) throws IOException
write
in class Writer
IOException
public void write(String str, int off, int len) throws IOException
write
in class Writer
IOException
public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
public void commit() throws IOException
IOException
public File getTemporaryFile()
Copyright © 2015. All rights reserved.