Interface FileIOChannel
-
- All Known Subinterfaces:
BlockChannelReader<T>
,BlockChannelWriter<T>
,BlockChannelWriterWithCallback<T>
,BufferFileReader
,BufferFileSegmentReader
,BufferFileWriter
,BulkBlockChannelReader
- All Known Implementing Classes:
AbstractFileIOChannel
,AsynchronousBlockReader
,AsynchronousBlockWriter
,AsynchronousBlockWriterWithCallback
,AsynchronousBufferFileReader
,AsynchronousBufferFileSegmentReader
,AsynchronousBufferFileWriter
,AsynchronousBulkBlockReader
,AsynchronousFileIOChannel
,CompressedBlockChannelReader
,CompressedBlockChannelWriter
,SynchronousBufferFileReader
,SynchronousFileIOChannel
public interface FileIOChannel
A Channel represents a collection of files that belong logically to the same resource. An example is a collection of files that contain sorted runs of data from the same stream, that will later on be merged together.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
FileIOChannel.Enumerator
An enumerator for channels that logically belong together.static class
FileIOChannel.ID
An ID identifying an underlying file channel.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.boolean
isClosed()
Checks whether the channel has been closed.
-
-
-
Method Detail
-
getChannelID
FileIOChannel.ID getChannelID()
Gets the channel ID of this I/O channel.- Returns:
- The channel ID.
-
getSize
long getSize() throws IOException
Gets the size (in bytes) of the file underlying the channel.- Throws:
IOException
-
isClosed
boolean isClosed()
Checks whether the channel has been closed.- Returns:
- True if the channel has been closed, false otherwise.
-
close
void close() throws IOException
Closes 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.- Throws:
IOException
- Thrown, if an error occurred while waiting for pending requests.
-
deleteChannel
void deleteChannel()
Deletes the file underlying this I/O channel.- Throws:
IllegalStateException
- Thrown, when the channel is still open.
-
getNioFileChannel
FileChannel getNioFileChannel()
-
closeAndDelete
void closeAndDelete() throws IOException
Closes the channel and deletes the underlying file. For asynchronous implementations, this method waits until all pending requests are handled.- Throws:
IOException
- Thrown, if an error occurred while waiting for pending requests.
-
-