Class RingBuffer<T>
java.lang.Object
org.craftercms.studio.impl.v2.utils.RingBuffer<T>
- Type Parameters:
T- type of objects to store
A special ring buffer implementation that allows unlimited writes
keeping only a preset size of buffer, followed by reading of what
was written in the order it was written ignoring what was overwritten
when writing beyond the preset size. This means you always read the
least recently written item.
This data structure cannot be written to once reading has begun.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
ringBuffer
-
writeCursor
protected int writeCursor -
readCursor
protected int readCursor -
size
protected int size
-
-
Constructor Details
-
RingBuffer
public RingBuffer(int size)
-
-
Method Details
-
write
-
read
-