PipedOutputStream
object by one thread and data is
read from the connected PipedInputStream
by some
other thread. Attempting to use both objects from a single thread
is not recommended as it may deadlock the thread.
The pipe is said to be broken if a
thread that was reading data bytes from the connected piped input
stream is no longer alive.
java.io.PipedInputStream
Modifier and Type | Field and Description |
---|---|
private volatile PipedInputStream |
Access | Constructor and Description |
---|---|
public | PipedOutputStream(PipedInputStream
The piped input stream to connect to. snk)Creates a piped output stream connected to the specified piped input stream. |
public |
Modifier and Type | Method and Description |
---|---|
public void | close()
Overrides java. Implements java. Closes this piped output stream and releases any system resources associated with this stream. |
public synchronized void | connect(PipedInputStream
the piped input stream to connect to. snk)Connects this piped output stream to a receiver. |
public synchronized void | flush()
Overrides java. Implements java. Flushes this output stream and forces any buffered output bytes to be written out. |
public void | write(int
the b)byte to be written.Implements abstract java. Writes the specified |
public void | write(byte[]
the data. b, int the start offset in the data. off, int the number of bytes to write. len)Overrides java. Writes |
sink | back to summary |
---|---|
private volatile PipedInputStream sink |
PipedOutputStream | back to summary |
---|---|
public PipedOutputStream(PipedInputStream snk) throws IOException Creates a piped output stream connected to the specified piped
input stream. Data bytes written to this stream will then be
available as input from
|
PipedOutputStream | back to summary |
---|---|
public PipedOutputStream() Creates a piped output stream that is not yet connected to a piped input stream. It must be connected to a piped input stream, either by the receiver or the sender, before being used. |
close | back to summary |
---|---|
public void close() throws IOException Overrides java. Implements java. Closes this piped output stream and releases any system resources associated with this stream. This stream may no longer be used for writing bytes.
|
connect | back to summary |
---|---|
public synchronized void connect(PipedInputStream snk) throws IOException Connects this piped output stream to a receiver. If this object
is already connected to some other piped input stream, an
If src.connect(snk) snk.connect(src)
|
flush | back to summary |
---|---|
public synchronized void flush() throws IOException Overrides java. Implements java. Flushes this output stream and forces any buffered output bytes to be written out. This will notify any readers that bytes are waiting in the pipe.
|
write | back to summary |
---|---|
public void write(int b) throws IOException Implements abstract java. Writes the specified
Implements the
|
write | back to summary |
---|---|
public void write(byte[] b, int off, int len) throws IOException Overrides java. Writes
|