Interface BlockChannelWriter<T>

  • All Superinterfaces:
    BlockChannelWriterWithCallback<T>, FileIOChannel
    All Known Implementing Classes:
    AsynchronousBlockWriter

    public interface BlockChannelWriter<T>
    extends BlockChannelWriterWithCallback<T>
    A writer that writes data in blocks to a file channel. The writer receives the data blocks in the form of MemorySegment, which it writes entirely to the channel, regardless of how space in the segment is used. The writing may be realized synchronously, or asynchronously, depending on the implementation.
    • Method Detail

      • getNextReturnedBlock

        T getNextReturnedBlock()
                        throws IOException
        Gets the next memory segment that has been written and is available again. This method blocks until such a segment is available, or until an error occurs in the writer, or the writer is closed.

        NOTE: If this method is invoked without any segment ever returning (for example, because the BlockChannelWriterWithCallback.writeBlock(T) method has not been invoked accordingly), the method may block forever.

        Returns:
        The next memory segment from the writers's return queue.
        Throws:
        IOException - Thrown, if an I/O error occurs in the writer while waiting for the request to return.
      • getReturnQueue

        LinkedBlockingQueue<T> getReturnQueue()
        Gets the queue in which the memory segments are queued after the asynchronous write is completed
        Returns:
        The queue with the written memory segments.