软件包 | 描述 |
---|---|
java.nio.channels |
定义了渠道,它代表的是能够执行I/O操作的实体连接,如文件和套接字;定义选择器,多路复用,非阻塞I/O操作。
|
java.nio.file |
定义的接口和类的java虚拟机访问文件,文件属性,文件系统。
|
java.nio.file.spi |
为
java.nio.file 包服务提供商类。
|
Modifier and Type | Class and Description |
---|---|
class |
FileChannel
用于读、写、映射和操作文件的通道。
|
Modifier and Type | Method and Description |
---|---|
SeekableByteChannel |
SeekableByteChannel.position(long newPosition)
设置此通道的位置。
|
SeekableByteChannel |
SeekableByteChannel.truncate(long size)
截断的实体,此通道是连接到给定的尺寸。
|
Modifier and Type | Method and Description |
---|---|
static SeekableByteChannel |
Files.newByteChannel(Path path, OpenOption... options)
打开或创建一个文件,返回一个可寻址的字节通道存取文件。
|
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 |
---|---|
abstract SeekableByteChannel |
FileSystemProvider.newByteChannel(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.