java.io.PipedOutputStream
java.io.OutputStream
None
None
JDK 1.0 or later
The PipedOutputStream class represents half of a communication pipe; a PipedOutputStream must be connected to a PipedOutputStream. When the two halves of a communication pipe are connected, data written to the PipedOutputStream can be read from the PipedInputStream. The communication pipe formed by a PipedOutputStream and a PipedInputStream should be used to communicate between threads. If both ends of a pipe are used by the same thread, the thread can hang.
public class java.io.PipedOutputStream extends java.io.OutputStream { // Constructors public PipedOutputStream(); public PipedOutputStream(PipedInputStream snk); // Instance Methods public void close(); public void connect(PipedInputStream snk); public synchronized void flush(); // New in 1.1 public void write(int b); public void write(byte[] b, int off, int len); }
This constructor creates a PipedOutputStream that is not connected to a PipedInputStream. The created object must be connected to a PipedInputStream before it can be used.
The PipedInputStream to connect.
If any kind of I/O error occurs.
This constructor creates a PipedOutputStream that sends data to the given PipedInputStream.
If any kind of I/O error occurs.
OutputStream.close()
This method closes the stream and releases the system resources that are associated with it.
The PipedInputStream to connect.
If another PipedInputStream is already connected to this PipedOutputStream or this PipedOutputStream is already connected.
This method connects this PipedOutputStream object to the given PipedInputStream. If this PipedOutputStream or snk is already connected, an exception is thrown.
New as of JDK 1.1
If any kind of I/O error occurs.
While this method is waiting for buffer space to become available, if the interrupted() method of the thread that invoked this method is called.
OutputStream.flush()
This method flushes the stream, which tells the connected PipedInputStream to notify its readers to read any available data.
The value to write.
If any kind of I/O error occurs.
While this method is waiting for buffer space to become available, if the interrupted() method of the thread that invoked this method is called.
OutputStream.write(int)
This method writes a byte of output. The method passes the given value directly to the connected PipedInputStream.
An array of bytes to write to the stream.
An offset into the byte array.
The number of bytes to write.
If any kind of I/O error occurs.
While this method is waiting for buffer space to become available, if the interrupted() method of the thread that invoked this method is called.
OutputStream.write(byte[], int, int)
This method writes len bytes of output from the given array, starting at offset off. The method passes the given data to the connected PipedInputStream.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
write(byte[]) |
OutputStream |
IOException, OutputStream, PipedInputStream