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 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 final class 
    An enumerator for channels that logically belong together.
    static class 
    An ID identifying an underlying file channel.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the channel.
    void
    Closes the channel and deletes the underlying file.
    void
    Deletes the file underlying this I/O channel.
    Gets the channel ID of this I/O channel.
     
    long
    Gets the size (in bytes) of the file underlying the channel.
    boolean
    Checks whether the channel has been closed.
  • Method Details

    • 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.