public class AtomicFileOutputStream extends FilterOutputStream
FilterOutputStream that writes to a file atomically.
The output file will not show up until it has been entirely written and sync'ed to disk.
It uses a temporary file when it is being written.
The default temporary file has a .tmp suffix.
When the output stream is closed, it is
(1) flushed
(2) sync'ed, and
(3) renamed/moved from the temporary file to the output file.
If the output file already exists, it will be overwritten.
NOTE that on Windows platforms, the output file, if it exists, is deleted
before the temporary file is moved.| 限定符和类型 | 字段和说明 |
|---|---|
static String |
TMP_EXTENSION |
out| 构造器和说明 |
|---|
AtomicFileOutputStream(File outFile) |
AtomicFileOutputStream(File outFile,
File tmpFile) |
public AtomicFileOutputStream(File outFile) throws FileNotFoundException
public AtomicFileOutputStream(File outFile, File tmpFile) throws FileNotFoundException
public boolean isClosed()
public void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 FilterOutputStreamIOExceptionpublic void abort()
Copyright © 2017–2023 The Apache Software Foundation. All rights reserved.