public abstract class AbstractFileIOChannel extends Object implements FileIOChannel
FileIOChannel.Enumerator, FileIOChannel.ID| 限定符和类型 | 字段和说明 |
|---|---|
protected FileChannel |
fileChannel
A file channel for NIO access to the file.
|
protected FileIOChannel.ID |
id
The ID of the underlying channel.
|
protected static org.slf4j.Logger |
LOG
Logger object for channel and its subclasses
|
| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractFileIOChannel(FileIOChannel.ID channelID,
boolean writeEnabled)
Creates a new channel to the path indicated by the given ID.
|
| 限定符和类型 | 方法和说明 |
|---|---|
abstract void |
close()
Closes the channel.
|
void |
closeAndDelete()
Closes the channel and deletes the underlying file.
|
void |
deleteChannel()
Deletes the file underlying this I/O channel.
|
FileIOChannel.ID |
getChannelID()
Gets the channel ID of this I/O channel.
|
FileChannel |
getNioFileChannel() |
long |
getSize()
Gets the size (in bytes) of the file underlying the channel.
|
abstract boolean |
isClosed()
Checks whether the channel has been closed.
|
protected static final org.slf4j.Logger LOG
protected final FileIOChannel.ID id
protected final FileChannel fileChannel
protected AbstractFileIOChannel(FileIOChannel.ID channelID, boolean writeEnabled) throws IOException
channelID - The id describing the path of the file that the channel accessed.writeEnabled - Flag describing whether the channel should be opened in read/write mode,
rather than in read-only mode.IOException - Thrown, if the channel could no be opened.public final FileIOChannel.ID getChannelID()
FileIOChannelgetChannelID 在接口中 FileIOChannelpublic long getSize()
throws IOException
FileIOChannelgetSize 在接口中 FileIOChannelIOExceptionpublic abstract boolean isClosed()
FileIOChannelisClosed 在接口中 FileIOChannelpublic abstract void close()
throws IOException
FileIOChannelclose 在接口中 FileIOChannelIOException - Thrown, if an error occurred while waiting for pending requests.public void deleteChannel()
FileIOChanneldeleteChannel 在接口中 FileIOChannelpublic void closeAndDelete()
throws IOException
FileIOChannelcloseAndDelete 在接口中 FileIOChannelIOException - Thrown, if an error occurred while waiting for pending requests.public FileChannel getNioFileChannel()
getNioFileChannel 在接口中 FileIOChannelCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.