|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.kafka.common.record.MemoryRecords
public class MemoryRecords
A Records
implementation backed by a ByteBuffer.
Nested Class Summary | |
---|---|
static class |
MemoryRecords.RecordsIterator
|
Field Summary |
---|
Fields inherited from interface org.apache.kafka.common.record.Records |
---|
LOG_OVERHEAD, OFFSET_LENGTH, SIZE_LENGTH |
Method Summary | |
---|---|
void |
append(long offset,
byte[] key,
byte[] value)
Append a new record and offset to the buffer |
void |
append(long offset,
Record record)
Append the given record and offset to the buffer |
java.nio.ByteBuffer |
buffer()
Get the byte buffer that backs this records instance |
int |
capacity()
Return the capacity of the buffer |
void |
close()
Close this batch for no more appends |
double |
compressionRate()
The compression rate of this record set |
static MemoryRecords |
emptyRecords(java.nio.ByteBuffer buffer,
CompressionType type)
|
static MemoryRecords |
emptyRecords(java.nio.ByteBuffer buffer,
CompressionType type,
int capacity)
|
boolean |
hasRoomFor(byte[] key,
byte[] value)
Check if we have room for a new record containing the given key/value pair Note that the return value is based on the estimate of the bytes written to the compressor, which may not be accurate if compression is really used. |
boolean |
isFull()
|
static MemoryRecords |
iterableRecords(java.nio.ByteBuffer buffer)
|
java.util.Iterator<LogEntry> |
iterator()
|
int |
sizeInBytes()
The size of this record set |
int |
writeTo(java.nio.channels.GatheringByteChannel channel)
Write the records in this set to the given channel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static MemoryRecords emptyRecords(java.nio.ByteBuffer buffer, CompressionType type, int capacity)
public static MemoryRecords emptyRecords(java.nio.ByteBuffer buffer, CompressionType type)
public static MemoryRecords iterableRecords(java.nio.ByteBuffer buffer)
public void append(long offset, Record record)
public void append(long offset, byte[] key, byte[] value)
public boolean hasRoomFor(byte[] key, byte[] value)
public boolean isFull()
public void close()
public int writeTo(java.nio.channels.GatheringByteChannel channel) throws java.io.IOException
writeTo
in interface Records
channel
- The channel to write to
java.io.IOException
- If the write fails.public int sizeInBytes()
sizeInBytes
in interface Records
public double compressionRate()
public int capacity()
public java.nio.ByteBuffer buffer()
public java.util.Iterator<LogEntry> iterator()
iterator
in interface java.lang.Iterable<LogEntry>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |