public interface BytesRingBuffer extends BytesRingBufferStats, BytesConsumer, net.openhft.chronicle.core.io.Closeable
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Modifier and Type | Method and Description |
---|---|
static Class<MultiReaderBytesRingBuffer> |
clazz() |
void |
clear()
clears the ring buffer but moving the read position to the write position
|
boolean |
isEmpty() |
static BytesRingBuffer |
newInstance(NativeBytesStore<Void> bytesStore) |
static MultiReaderBytesRingBuffer |
newInstance(NativeBytesStore<Void> bytesStore,
int numReaders) |
boolean |
offer(BytesStore bytes0)
Inserts the specified element at the tail of this queue if it is possible to do so
immediately without exceeding the queue's capacity,
|
boolean |
offer(Consumer<Bytes> consumer) |
boolean |
read(BytesOut using)
Retrieves and removes the head of this queue, or returns
null if this queue is
empty. |
long |
readRemaining() |
static long |
sizeFor(long capacity) |
static long |
sizeFor(long capacity,
int numReaders) |
capacity, getAndClearContentionCount, getAndClearMissedWriteCount, getAndClearWriteCount, maxCopyTimeNs, minNumberOfWriteBytesRemaining, readers
@NotNull static BytesRingBuffer newInstance(@NotNull NativeBytesStore<Void> bytesStore)
@NotNull static MultiReaderBytesRingBuffer newInstance(@NotNull NativeBytesStore<Void> bytesStore, int numReaders)
@NotNull static Class<MultiReaderBytesRingBuffer> clazz() throws ClassNotFoundException
ClassNotFoundException
static long sizeFor(long capacity)
static long sizeFor(long capacity, int numReaders)
void clear()
boolean offer(@NotNull BytesStore bytes0)
bytes0
- the bytes0
that you wish to add to the ring buffertrue
upon success and false
if this queue is full.boolean offer(@NotNull Consumer<Bytes> consumer)
consumer
- a bytes consumer, when you accept
this message you will write
directly into the ring buffer, you don't have to worry about wrapping the
ring buffer this is handled for you.true
if you where able to write the bytes to the ring bufer, else false
indicates nothing was written.boolean read(@NotNull BytesOut using) throws BufferOverflowException
null
if this queue is
empty.read
in interface BytesConsumer
using
- Bytes to read into.BufferOverflowException
- is the using
buffer is not large enoughlong readRemaining()
boolean isEmpty()
Copyright © 2018. All rights reserved.