public class QueueOutputStream
extends java.io.OutputStream
PipedOutputStream; queue input stream provides what's written in queue
output stream.
Example usage:
QueueOutputStream outputStream = new QueueOutputStream();
QueueInputStream inputStream = outputStream.newPipeInputStream();
outputStream.write("hello world".getBytes(UTF_8));
inputStream.read();
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 QueueOutputStream has no effect. The methods in this class can be called after the stream has been
closed without generating an IOException.
QueueInputStream| Constructor and Description |
|---|
QueueOutputStream()
Constructs a new instance with no limit to internal buffer size.
|
QueueOutputStream(java.util.concurrent.BlockingQueue<java.lang.Integer> blockingQueue)
Constructs a new instance with given buffer.
|
| Modifier and Type | Method and Description |
|---|---|
QueueInputStream |
newQueueInputStream()
Creates a new QueueInputStream instance connected to this.
|
void |
write(int b)
Writes a single byte.
|
public QueueOutputStream()
public QueueOutputStream(java.util.concurrent.BlockingQueue<java.lang.Integer> blockingQueue)
blockingQueue - backing queue for the streampublic QueueInputStream newQueueInputStream()
public void write(int b)
throws java.io.InterruptedIOException
write in class java.io.OutputStreamjava.io.InterruptedIOException - if the thread is interrupted while writing to the queue.Copyright © 2010 - 2023 Adobe. All Rights Reserved