📅  最后修改于: 2020-11-15 02:48:48             🧑  作者: Mango
Java.io.PipedOutputStream类是管道输出流,可以将其连接到管道输入流以创建通信管道。以下是关于PipedOutputStream的要点-
管道输出流是管道的发送端。
不建议尝试从单个线程使用两个对象,因为这可能会死锁该线程。
一个线程将数据写入PipedOutputStream对象,其他线程从连接的PipedInputStream读取数据。
如果从连接的管道输入流中读取数据字节的线程不再活动,则称管道已损坏。
以下是Java.io.PipedOutputStream类的声明-
public class PipedOutputStream
extends OutputStream
Sr.No. | Constructor & Description |
---|---|
1 |
PipedOutputStream() This creates a piped output stream that is not yet connected to a piped input stream. |
2 |
PipedOutputStream(PipedInputStream snk) This creates a piped output stream connected to the specified piped input stream. |
Sr.No. | Method & Description |
---|---|
1 | void close()
This method closes this piped output stream and releases any system resources associated with this stream. |
2 | void connect(PipedInputStream snk)
This method connects this piped output stream to a receiver. |
3 | void flush()
This method flushes this output stream and forces any buffered output bytes to be written out. |
4 | void write(byte[] b, int off, int len)
This method writes len bytes from the specified byte array starting at offset off to this piped output stream. |
5 | void write(int b)
This method writes the specified byte to the piped output stream. |
此类从以下类继承方法-