Class ResizableMultiReaderRingBuffer<T>


  • public class ResizableMultiReaderRingBuffer<T>
    extends java.lang.Object
    The number of elements currently in the buffer.
    • Method Detail

      • 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. Returns true if 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)
      • underlyingArray

        protected java.lang.Object[] underlyingArray()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object