Class AbstractFileIOChannel
java.lang.Object
org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
- All Implemented Interfaces:
FileIOChannel
- Direct Known Subclasses:
AsynchronousFileIOChannel,SynchronousFileIOChannel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.disk.iomanager.FileIOChannel
FileIOChannel.Enumerator, FileIOChannel.ID -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FileChannelA file channel for NIO access to the file.protected final FileIOChannel.IDThe ID of the underlying channel.protected static final org.slf4j.LoggerLogger object for channel and its subclasses -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFileIOChannel(FileIOChannel.ID channelID, boolean writeEnabled) Creates a new channel to the path indicated by the given ID. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()Closes the channel.voidCloses the channel and deletes the underlying file.voidDeletes the file underlying this I/O channel.final FileIOChannel.IDGets the channel ID of this I/O channel.longgetSize()Gets the size (in bytes) of the file underlying the channel.abstract booleanisClosed()Checks whether the channel has been closed.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger object for channel and its subclasses -
id
The ID of the underlying channel. -
fileChannel
A file channel for NIO access to the file.
-
-
Constructor Details
-
AbstractFileIOChannel
protected AbstractFileIOChannel(FileIOChannel.ID channelID, boolean writeEnabled) throws IOException Creates a new channel to the path indicated by the given ID. The channel hands IO requests to the given request queue to be processed.- Parameters:
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.- Throws:
IOException- Thrown, if the channel could no be opened.
-
-
Method Details
-
getChannelID
Description copied from interface:FileIOChannelGets the channel ID of this I/O channel.- Specified by:
getChannelIDin interfaceFileIOChannel- Returns:
- The channel ID.
-
getSize
Description copied from interface:FileIOChannelGets the size (in bytes) of the file underlying the channel.- Specified by:
getSizein interfaceFileIOChannel- Throws:
IOException
-
isClosed
public abstract boolean isClosed()Description copied from interface:FileIOChannelChecks whether the channel has been closed.- Specified by:
isClosedin interfaceFileIOChannel- Returns:
- True if the channel has been closed, false otherwise.
-
close
Description copied from interface:FileIOChannelCloses the channel. For asynchronous implementations, this method waits until all pending requests are handled. Even if an exception interrupts the closing, the underlying FileChannel is closed.- Specified by:
closein interfaceFileIOChannel- Throws:
IOException- Thrown, if an error occurred while waiting for pending requests.
-
deleteChannel
public void deleteChannel()Description copied from interface:FileIOChannelDeletes the file underlying this I/O channel.- Specified by:
deleteChannelin interfaceFileIOChannel
-
closeAndDelete
Description copied from interface:FileIOChannelCloses the channel and deletes the underlying file. For asynchronous implementations, this method waits until all pending requests are handled.- Specified by:
closeAndDeletein interfaceFileIOChannel- Throws:
IOException- Thrown, if an error occurred while waiting for pending requests.
-
getNioFileChannel
- Specified by:
getNioFileChannelin interfaceFileIOChannel
-