软件包 | 描述 |
---|---|
java.io |
通过数据流、序列化和文件系统提供系统的输入和输出。
|
java.nio.channels |
定义了渠道,它代表的是能够执行I/O操作的实体连接,如文件和套接字;定义选择器,多路复用,非阻塞I/O操作。
|
java.nio.file.spi |
为
java.nio.file 包服务提供商类。
|
Modifier and Type | Method and Description |
---|---|
FileChannel |
RandomAccessFile.getChannel()
返回与该文件相关的独特的
FileChannel 对象。
|
FileChannel |
FileInputStream.getChannel()
返回与此文件输入流有关的独特的
FileChannel 对象。
|
FileChannel |
FileOutputStream.getChannel()
返回与此文件输出流相关的独特的
FileChannel 对象。
|
Modifier and Type | Method and Description |
---|---|
FileChannel |
FileLock.channel()
返回获取该锁的文件的文件通道。
|
static FileChannel |
FileChannel.open(Path path, OpenOption... options)
打开或创建一个文件,返回一个文件通道来访问该文件。
|
static FileChannel |
FileChannel.open(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)
打开或创建一个文件,返回一个文件通道来访问该文件。
|
abstract FileChannel |
FileChannel.position(long newPosition)
设置此通道的文件位置。
|
abstract FileChannel |
FileChannel.truncate(long size)
将这一渠道的文件的大小。
|
Constructor and Description |
---|
FileLock(FileChannel channel, long position, long size, boolean shared)
初始化该类的一个新实例。
|
Modifier and Type | Method and Description |
---|---|
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.