org.apache.kafka.common.network
Class ByteBufferReceive

java.lang.Object
  extended by org.apache.kafka.common.network.ByteBufferReceive
All Implemented Interfaces:
Receive

public class ByteBufferReceive
extends java.lang.Object
implements Receive

A receive backed by an array of ByteBuffers


Constructor Summary
ByteBufferReceive(int source, java.nio.ByteBuffer... buffers)
           
 
Method Summary
 boolean complete()
          Are we done receiving data?
 long readFrom(java.nio.channels.ScatteringByteChannel channel)
          Read bytes into this receive from the given channel
 java.nio.ByteBuffer[] reify()
          Turn this receive into ByteBuffer instances, if possible (otherwise returns null).
 int source()
          The numeric id of the source from which we are receiving data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferReceive

public ByteBufferReceive(int source,
                         java.nio.ByteBuffer... buffers)
Method Detail

source

public int source()
Description copied from interface: Receive
The numeric id of the source from which we are receiving data.

Specified by:
source in interface Receive

complete

public boolean complete()
Description copied from interface: Receive
Are we done receiving data?

Specified by:
complete in interface Receive

readFrom

public long readFrom(java.nio.channels.ScatteringByteChannel channel)
              throws java.io.IOException
Description copied from interface: Receive
Read bytes into this receive from the given channel

Specified by:
readFrom in interface Receive
Parameters:
channel - The channel to read from
Returns:
The number of bytes read
Throws:
java.io.IOException - If the reading fails

reify

public java.nio.ByteBuffer[] reify()
Description copied from interface: Receive
Turn this receive into ByteBuffer instances, if possible (otherwise returns null).

Specified by:
reify in interface Receive