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,SynchronousBufferFileReader,SynchronousFileIOChannel
public interface FileIOChannelA 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 classFileIOChannel.EnumeratorAn enumerator for channels that logically belong together.static classFileIOChannel.IDAn ID identifying an underlying file channel.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the channel.voidcloseAndDelete()Closes the channel and deletes the underlying file.voiddeleteChannel()Deletes the file underlying this I/O channel.FileIOChannel.IDgetChannelID()Gets the channel ID of this I/O channel.FileChannelgetNioFileChannel()longgetSize()Gets the size (in bytes) of the file underlying the channel.booleanisClosed()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 IOExceptionGets 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 IOExceptionCloses 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 IOExceptionCloses 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.
-
-