接口的使用
java.nio.file.OpenOption
使用 OpenOption 的包
包
描述
HTTP 客户端和 WebSocket API
定义通道,它表示与能够执行 I/O 操作的实体的连接,例如文件和套接字;定义选择器,用于多路复用、非阻塞 I/O 操作。
定义Java虚拟机访问文件、文件属性和文件系统的接口和类。
java.nio.file 包的服务提供商类。
-
OpenOption 在 java.net.http 中的用法
java.net.http 中的方法,参数类型为 OpenOption修饰符和类型方法描述static HttpResponse.BodyHandler<Path>HttpResponse.BodyHandlers.ofFile(Path file, OpenOption... openOptions) static HttpResponse.BodySubscriber<Path>HttpResponse.BodySubscribers.ofFile(Path file, OpenOption... openOptions) 返回一个BodySubscriber,它将响应主体存储在使用给定选项和名称打开的文件中。static HttpResponse.BodyHandler<Path>HttpResponse.BodyHandlers.ofFileDownload(Path directory, OpenOption... openOptions) -
OpenOption 在 java.nio.channels 中的用法
java.nio.channels 中的方法,参数类型为 OpenOption修饰符和类型方法描述static AsynchronousFileChannelAsynchronousFileChannel.open(Path file, OpenOption... options) 打开或创建用于读取和/或写入的文件,返回异步文件通道以访问该文件。static FileChannelFileChannel.open(Path path, OpenOption... options) 打开或创建一个文件,返回一个文件通道来访问该文件。java.nio.channels 中的方法参数,类型参数为 OpenOption修饰符和类型方法描述static AsynchronousFileChannelAsynchronousFileChannel.open(Path file, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) 打开或创建用于读取和/或写入的文件,返回异步文件通道以访问该文件。static FileChannelFileChannel.open(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) 打开或创建一个文件,返回一个文件通道来访问该文件。 -
OpenOption 在 java.nio.file 中的用法
java.nio.file 中实现 OpenOption 的类java.nio.file 中的方法,参数类型为 OpenOption修饰符和类型方法描述static BufferedWriterFiles.newBufferedWriter(Path path, Charset cs, OpenOption... options) 打开或创建一个用于写入的文件,返回一个BufferedWriter可用于以有效的方式将文本写入文件。static BufferedWriterFiles.newBufferedWriter(Path path, OpenOption... options) 打开或创建用于写入的文件,返回BufferedWriter以高效方式将文本写入文件。static SeekableByteChannelFiles.newByteChannel(Path path, OpenOption... options) 打开或创建一个文件,返回一个可搜索的字节通道来访问该文件。static InputStreamFiles.newInputStream(Path path, OpenOption... options) 打开一个文件,返回一个输入流以从文件中读取。static OutputStreamFiles.newOutputStream(Path path, OpenOption... options) 打开或创建文件,返回可用于将字节写入文件的输出流。static PathFiles.write(Path path, byte[] bytes, OpenOption... options) 将字节写入文件。static PathFiles.write(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options) 将文本行写入文件。static PathFiles.write(Path path, Iterable<? extends CharSequence> lines, OpenOption... options) 将文本行写入文件。static PathFiles.writeString(Path path, CharSequence csq, Charset cs, OpenOption... options) 将 CharSequence 写入文件。static PathFiles.writeString(Path path, CharSequence csq, OpenOption... options) 将 CharSequence 写入文件。java.nio.file 中的方法参数,类型参数为 OpenOption修饰符和类型方法描述static SeekableByteChannelFiles.newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) 打开或创建一个文件,返回一个可搜索的字节通道来访问该文件。SecureDirectoryStream.newByteChannel(T path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) 在此目录中打开或创建一个文件,返回一个可搜索的字节通道以访问该文件。 -
OpenOption 在 java.nio.file.spi 中的用法
java.nio.file.spi 中的方法,参数类型为 OpenOption修饰符和类型方法描述FileSystemProvider.newInputStream(Path path, OpenOption... options) 打开一个文件,返回一个输入流以从文件中读取。FileSystemProvider.newOutputStream(Path path, OpenOption... options) 打开或创建文件,返回可用于将字节写入文件的输出流。java.nio.file.spi 中的方法参数,类型参数为 OpenOption修饰符和类型方法描述FileSystemProvider.newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs) 打开或创建用于读取和/或写入的文件,返回异步文件通道以访问该文件。abstract SeekableByteChannelFileSystemProvider.newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) 打开或创建一个文件,返回一个可搜索的字节通道来访问该文件。FileSystemProvider.newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) 打开或创建用于读取和/或写入的文件,返回文件通道以访问该文件。