Search in sources :

Example 6 with ByteBufferOutputStream

use of org.apache.kafka.common.utils.ByteBufferOutputStream in project kafka by apache.

the class Record method write.

private static void write(ByteBuffer buffer, byte magic, long timestamp, ByteBuffer key, ByteBuffer value, CompressionType compressionType, TimestampType timestampType) {
    try {
        DataOutputStream out = new DataOutputStream(new ByteBufferOutputStream(buffer));
        write(out, magic, timestamp, key, value, compressionType, timestampType);
    } catch (IOException e) {
        throw new KafkaException(e);
    }
}
Also used : ByteBufferOutputStream(org.apache.kafka.common.utils.ByteBufferOutputStream) DataOutputStream(java.io.DataOutputStream) KafkaException(org.apache.kafka.common.KafkaException) IOException(java.io.IOException)

Aggregations

ByteBufferOutputStream (org.apache.kafka.common.utils.ByteBufferOutputStream)6 ByteBuffer (java.nio.ByteBuffer)5 Test (org.junit.Test)5 DataOutputStream (java.io.DataOutputStream)4 KafkaException (org.apache.kafka.common.KafkaException)2 ByteBufferInputStream (org.apache.kafka.common.utils.ByteBufferInputStream)2 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1