package java.nio.file;
/**
* Defines the standard open options.
*
* @since 1.7
*/
public enum StandardOpenOption implements OpenOption {
/**
* 读取一个已存在的文件,如果文件不存在或被占用则抛出异常
*/
READ,
/**
* 以追加到文件头部的方式,写入一个已存在的文件,如果文件不存在或被占用则抛出异常
*/
WRITE,
/**
* 以追加到文件尾部的方式,写入一个已存在的文件,如果文件不存在或被占用则抛出异常
*/
APPEND,
/**
* If the file already exists and it is opened for {@link #WRITE}
* access, then its length is truncated to 0. This option is ignored
* if the file is opened only for {@link #READ} access.
*/
TRUNCATE_EXISTING,
/**
* 创建一个空文件,如果文件存在则不创建
*/
CREATE,
/**
* 创建一个空文件,如果文件存在则报错
*/
CREATE_NEW,
/**
* 流和管道关闭时删除文件,如果流和管道没有关闭,则在Java虚拟机退出时删除文件
*/
DELETE_ON_CLOSE,
/**
* Sparse file. When used with the {@link #CREATE_NEW} option then this
* option provides a <em>hint</em> that the new file will be sparse. The
* option is ignored when the file system does not support the creation of
* sparse files.
*/
SPARSE,
/**
* Requires that every update to the file's content or metadata be written
* synchronously to the underlying storage device.
*
* @see <a href="package-summary.html#integrity">Synchronized I/O file integrity</a>
*/
SYNC,
/**
* Requires that every update to the file's content be written
* synchronously to the underlying storage device.
*
* @see <a href="package-summary.html#integrity">Synchronized I/O file integrity</a>
*/
DSYNC;
}
StandardOpenOption内容
最新推荐文章于 2024-11-03 11:01:20 发布