Package akka.stream.impl
Class ResizableMultiReaderRingBuffer<T>
- java.lang.Object
-
- akka.stream.impl.ResizableMultiReaderRingBuffer<T>
-
public class ResizableMultiReaderRingBuffer<T> extends java.lang.ObjectThe number of elements currently in the buffer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceResizableMultiReaderRingBuffer.Cursorstatic interfaceResizableMultiReaderRingBuffer.Cursorsstatic classResizableMultiReaderRingBuffer.NothingToReadException$
-
Constructor Summary
Constructors Constructor Description ResizableMultiReaderRingBuffer(int initialSize, int maxSize, ResizableMultiReaderRingBuffer.Cursors cursors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcount(ResizableMultiReaderRingBuffer.Cursor cursor)Returns the number of elements that the buffer currently contains for the given cursor.ResizableMultiReaderRingBuffer.Cursorscursors()intimmediatelyAvailable()The number of elements the buffer can still take without having to be resized.voidinitCursor(ResizableMultiReaderRingBuffer.Cursor cursor)Initializes the given Cursor to the oldest buffer entry that is still available.booleanisEmpty()intmaxAvailable()The maximum number of elements the buffer can still take.booleannonEmpty()voidonCursorRemoved(ResizableMultiReaderRingBuffer.Cursor cursor)Tread(ResizableMultiReaderRingBuffer.Cursor cursor)Tries to read from the buffer using the given Cursor.intsize()The number of elements currently in the buffer.java.lang.StringtoString()protected java.lang.Object[]underlyingArray()booleanwrite(T value)Tries to write the given value into the buffer thereby potentially growing the backing array.
-
-
-
Constructor Detail
-
ResizableMultiReaderRingBuffer
public ResizableMultiReaderRingBuffer(int initialSize, int maxSize, ResizableMultiReaderRingBuffer.Cursors cursors)
-
-
Method Detail
-
cursors
public ResizableMultiReaderRingBuffer.Cursors cursors()
-
size
public int size()
The number of elements currently in the buffer.- Returns:
- (undocumented)
-
isEmpty
public boolean isEmpty()
-
nonEmpty
public boolean nonEmpty()
-
immediatelyAvailable
public int immediatelyAvailable()
The number of elements the buffer can still take without having to be resized.- Returns:
- (undocumented)
-
maxAvailable
public int maxAvailable()
The maximum number of elements the buffer can still take.- Returns:
- (undocumented)
-
count
public int count(ResizableMultiReaderRingBuffer.Cursor cursor)
Returns the number of elements that the buffer currently contains for the given cursor.- Parameters:
cursor- (undocumented)- Returns:
- (undocumented)
-
initCursor
public void initCursor(ResizableMultiReaderRingBuffer.Cursor cursor)
Initializes the given Cursor to the oldest buffer entry that is still available.- Parameters:
cursor- (undocumented)
-
write
public boolean write(T value)
Tries to write the given value into the buffer thereby potentially growing the backing array. Returnstrueif the write was successful and false if the buffer is full and cannot grow anymore.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
read
public T read(ResizableMultiReaderRingBuffer.Cursor cursor)
Tries to read from the buffer using the given Cursor. If there are no more data to be read (i.e. the cursor is already at writeIx) the method throws ResizableMultiReaderRingBuffer.NothingToReadException!- Parameters:
cursor- (undocumented)- Returns:
- (undocumented)
-
onCursorRemoved
public void onCursorRemoved(ResizableMultiReaderRingBuffer.Cursor cursor)
-
underlyingArray
protected java.lang.Object[] underlyingArray()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-