public class AtomicFileWriter
extends java.io.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(java.io.File f) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
commit() |
void |
flush() |
java.io.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(java.lang.String str,
int off,
int len) |
public AtomicFileWriter(java.io.File f) throws java.io.IOException
java.io.IOException
public void write(int c) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(java.lang.String str, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
public void commit() throws java.io.IOException
java.io.IOException
public java.io.File getTemporaryFile()
Copyright © 2013. All Rights Reserved.