org.apache.kafka.common.network
Interface Send

All Known Implementing Classes:
ByteBufferSend, NetworkSend, RequestSend

public interface Send

This interface models the in-progress sending of data to a destination identified by an integer id.


Method Summary
 boolean completed()
          Is this send complete?
 int destination()
          The numeric id for the destination of this send
 java.nio.ByteBuffer[] reify()
          An optional method to turn this send into an array of ByteBuffers if possible (otherwise returns null)
 int remaining()
          The number of bytes remaining to send
 long writeTo(java.nio.channels.GatheringByteChannel channel)
          Write some as-yet unwritten bytes from this send to the provided channel.
 

Method Detail

destination

int destination()
The numeric id for the destination of this send


remaining

int remaining()
The number of bytes remaining to send


completed

boolean completed()
Is this send complete?


reify

java.nio.ByteBuffer[] reify()
An optional method to turn this send into an array of ByteBuffers if possible (otherwise returns null)


writeTo

long writeTo(java.nio.channels.GatheringByteChannel channel)
             throws java.io.IOException
Write some as-yet unwritten bytes from this send to the provided channel. It may take multiple calls for the send to be completely written

Parameters:
channel - The channel to write to
Returns:
The number of bytes written
Throws:
java.io.IOException - If the write fails