软件包 | 描述 |
---|---|
java.nio.channels |
定义了渠道,它代表的是能够执行I/O操作的实体连接,如文件和套接字;定义选择器,多路复用,非阻塞I/O操作。
|
java.nio.file |
定义的接口和类的java虚拟机访问文件,文件属性,文件系统。
|
java.nio.file.attribute |
提供对文件和文件系统属性的访问的接口和类。
|
java.nio.file.spi |
为
java.nio.file 包服务提供商类。
|
Modifier and Type | Method and Description |
---|---|
static AsynchronousFileChannel |
AsynchronousFileChannel.open(Path file, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs)
打开或创建一个用于读取和/或写入的文件,返回一个异步文件通道来访问该文件。
|
static FileChannel |
FileChannel.open(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
打开或创建一个文件,返回一个文件通道来访问该文件。
|
Modifier and Type | Method and Description |
---|---|
static Path |
Files.createDirectories(Path dir, FileAttribute<?>... attrs)
创建一个目录,通过创建所有不存在的父目录。
|
static Path |
Files.createDirectory(Path dir, FileAttribute<?>... attrs)
创建一个新目录。
|
static Path |
Files.createFile(Path path, FileAttribute<?>... attrs)
创建一个新的和空的文件,如果文件已经存在,失败了。
|
static Path |
Files.createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs)
创建一个符号链接到一个目标(可选操作)。
|
static Path |
Files.createTempDirectory(Path dir, String prefix, FileAttribute<?>... attrs)
在指定的目录中创建一个新的目录,使用给定的前缀来生成它的名称。
|
static Path |
Files.createTempDirectory(String prefix, FileAttribute<?>... attrs)
在默认的临时文件目录中创建一个新目录,使用给定的前缀生成它的名称。
|
static Path |
Files.createTempFile(Path dir, String prefix, String suffix, FileAttribute<?>... attrs)
在指定的目录中创建一个新的空文件,使用给定的前缀和后缀字符串来生成它的名称。
|
static Path |
Files.createTempFile(String prefix, String suffix, FileAttribute<?>... attrs)
在默认的临时文件目录中创建一个空文件,使用给定的前缀和后缀来生成它的名称。
|
static SeekableByteChannel |
Files.newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
打开或创建一个文件,返回一个可寻址的字节通道存取文件。
|
SeekableByteChannel |
SecureDirectoryStream.newByteChannel(T path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
打开或创建此目录中的文件,返回一个可寻址的字节通道存取文件。
|
Modifier and Type | Method and Description |
---|---|
static FileAttribute<Set<PosixFilePermission>> |
PosixFilePermissions.asFileAttribute(Set<PosixFilePermission> perms)
|
Modifier and Type | Method and Description |
---|---|
abstract void |
FileSystemProvider.createDirectory(Path dir, FileAttribute<?>... attrs)
创建一个新目录。
|
void |
FileSystemProvider.createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs)
创建一个目标的符号链接。
|
AsynchronousFileChannel |
FileSystemProvider.newAsynchronousFileChannel(Path path, Set<? extends OpenOption> options, ExecutorService executor, FileAttribute<?>... attrs)
打开或创建一个用于读取和/或写入的文件,返回一个异步文件通道来访问该文件。
|
abstract SeekableByteChannel |
FileSystemProvider.newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
打开或创建一个文件,返回一个可寻址的字节通道存取文件。
|
FileChannel |
FileSystemProvider.newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
打开或创建一个用于读取和/或写入的文件,返回一个文件通道以访问该文件。
|
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.