软件包 | 描述 |
---|---|
java.nio.channels |
定义了渠道,它代表的是能够执行I/O操作的实体连接,如文件和套接字;定义选择器,多路复用,非阻塞I/O操作。
|
java.nio.file |
定义的接口和类的java虚拟机访问文件,文件属性,文件系统。
|
java.nio.file.spi |
为
java.nio.file 包服务提供商类。
|
Modifier and Type | Method and Description |
---|---|
static AsynchronousFileChannel |
AsynchronousFileChannel.open(Path file, OpenOption... options)
打开或创建一个用于读取和/或写入的文件,返回一个异步文件通道来访问该文件。
|
static FileChannel |
FileChannel.open(Path path, OpenOption... options)
打开或创建一个文件,返回一个文件通道来访问该文件。
|
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 | Class and Description |
---|---|
class |
LinkOption
定义如何处理符号链接的选项。
|
class |
StandardOpenOption
定义标准的开放选项。
|
Modifier and Type | Method and Description |
---|---|
static BufferedWriter |
Files.newBufferedWriter(Path path, Charset cs, OpenOption... options)
打开或创建一个文件写入,返回一个
BufferedWriter ,可以有效的方式将文件写入文本。
|
static BufferedWriter |
Files.newBufferedWriter(Path path, OpenOption... options)
打开或创建一个文件写入,返回一个
BufferedWriter 能够以有效的方式的文件写入文本。
|
static SeekableByteChannel |
Files.newByteChannel(Path path, OpenOption... options)
打开或创建一个文件,返回一个可寻址的字节通道存取文件。
|
static InputStream |
Files.newInputStream(Path path, OpenOption... options)
打开一个文件,返回一个输入流从文件中读取。
|
static OutputStream |
Files.newOutputStream(Path path, OpenOption... options)
打开或创建一个文件,返回一个可用于将字节写入文件的输出流。
|
static Path |
Files.write(Path path, byte[] bytes, OpenOption... options)
将字节写入到文件中。
|
static Path |
Files.write(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options)
写入文本到文件的行。
|
static Path |
Files.write(Path path, Iterable<? extends CharSequence> lines, OpenOption... options)
写入文本到文件的行。
|
Modifier and Type | Method and Description |
---|---|
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 |
---|---|
InputStream |
FileSystemProvider.newInputStream(Path path, OpenOption... options)
打开一个文件,返回一个输入流从文件中读取。
|
OutputStream |
FileSystemProvider.newOutputStream(Path path, OpenOption... options)
打开或创建一个文件,返回一个可用于将字节写入文件的输出流。
|
Modifier and Type | Method and Description |
---|---|
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.