Class QueueInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public class QueueInputStream extends InputStream
Simple alternative to JDK PipedInputStream; queue input stream provides what's written in queue output stream.

To build an instance, use QueueInputStream.Builder.

Example usage:

 QueueInputStream inputStream = new QueueInputStream();
 QueueOutputStream outputStream = inputStream.newQueueOutputStream();

 outputStream.write("hello world".getBytes(UTF_8));;

Unlike JDK PipedInputStream and PipedOutputStream, queue input/output streams may be used safely in a single thread or multiple threads. Also, unlike JDK classes, no special meaning is attached to initial or current thread. Instances can be used longer after initial threads exited.

Closing a QueueInputStream has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.

See Also: