Class ArrayBlockingStream<T>
java.lang.Object
fr.lirmm.graphik.util.stream.AbstractCloseableIterator<T>
fr.lirmm.graphik.util.stream.ArrayBlockingStream<T>
- Type Parameters:
T- type of elements stored in the stream
- All Implemented Interfaces:
CloseableIterator<T>, CloseableIteratorWithoutException<T>, InMemoryStream<T>, Stream<T>, Writer<T>, Closeable, AutoCloseable, Iterator<T>
public class ArrayBlockingStream<T>
extends AbstractCloseableIterator<T>
implements InMemoryStream<T>
Concurrent in-memory stream backed by a circular array.
- Author:
- Clément Sipieter (INRIA) clement@6pi.fr
-
Constructor Summary
ConstructorsConstructorDescriptionArrayBlockingStream(int bufferSize) Creates a blocking stream with the provided buffer size. -
Method Summary
Methods inherited from class AbstractCloseableIterator
finalizeMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining, remove
-
Constructor Details
-
ArrayBlockingStream
public ArrayBlockingStream(int bufferSize) Creates a blocking stream with the provided buffer size.- Parameters:
bufferSize- the ring-buffer capacity
-
-
Method Details
-
write
-
hasNext
public boolean hasNext()Description copied from interface:CloseableIteratorReturns whether another element is available.- Specified by:
hasNextin interfaceCloseableIterator<T>- Specified by:
hasNextin interfaceCloseableIteratorWithoutException<T>- Specified by:
hasNextin interfaceIterator<T>- Returns:
- true if another element can be read
-
next
Description copied from interface:CloseableIteratorReturns the next element.- Specified by:
nextin interfaceCloseableIterator<T>- Specified by:
nextin interfaceCloseableIteratorWithoutException<T>- Specified by:
nextin interfaceIterator<T>- Returns:
- the next element
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableIterator<T>
-
write
-