Search in sources :

Example 6 with ByteBufferChannel

use of org.apache.kafka.common.requests.ByteBufferChannel in project kafka by apache.

the class TestUtils method toBuffer.

public static ByteBuffer toBuffer(Send send) {
    ByteBufferChannel channel = new ByteBufferChannel(send.size());
    try {
        assertEquals(send.size(), send.writeTo(channel));
        channel.close();
        return channel.buffer();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : ByteBufferChannel(org.apache.kafka.common.requests.ByteBufferChannel) IOException(java.io.IOException)

Aggregations

ByteBufferChannel (org.apache.kafka.common.requests.ByteBufferChannel)6 Send (org.apache.kafka.common.network.Send)3 Benchmark (org.openjdk.jmh.annotations.Benchmark)3 IOException (java.io.IOException)1