|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.io.OutputStream
java.io.PipedOutputStream
public class PipedOutputStream
传送输出流可以连接到传送输入流,以创建通信管道。传送输出流是管道的发送端。通常,数据由某个线程写入 PipedOutputStream 对象,并由其他线程从连接的 PipedInputStream 读取。不建议对这两个对象尝试使用单个线程,因为这样可能会死锁该线程。
PipedInputStream| 构造方法摘要 | |
|---|---|
PipedOutputStream()
创建尚未连接到传送输入流的传送输出流。 |
|
PipedOutputStream(PipedInputStream snk)
创建连接到指定传送输入流的传送输出流。 |
|
| 方法摘要 | |
|---|---|
void |
close()
关闭此传送输出流并释放与此流相关的所有系统资源。 |
void |
connect(PipedInputStream snk)
将此传送输出流连接到接收者。 |
void |
flush()
刷新此输出流并强制写出所有缓冲的输出字节。 |
void |
write(byte[] b,
int off,
int len)
将 len 字节从指定的初始偏移量为 off 的字节数组写入到该传送输出流。 |
void |
write(int b)
将指定 byte 写入传送的输出流。 |
| 从类 java.io.OutputStream 继承的方法 |
|---|
write |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public PipedOutputStream(PipedInputStream snk)
throws IOException
snk 的输入。
snk - 要连接的传送输入流。
IOException - 如果发生 I/O 错误。public PipedOutputStream()
PipedInputStream.connect(java.io.PipedOutputStream),
connect(java.io.PipedInputStream)| 方法详细信息 |
|---|
public void connect(PipedInputStream snk)
throws IOException
IOException。
如果 snk 为未连接的传送输入流,而 src 为未连接的传送输出流,则可以通过以下任一调用使其连接:
或:src.connect(snk)
这两个调用的效果相同。snk.connect(src)
snk - 要连接的传送输入流。
IOException - 如果发生 I/O 错误。
public void write(int b)
throws IOException
byte 写入传送的输出流。如果某个线程正从连接的传送输入流读取数据字节,但该线程不再处于活动状态,则抛出 IOException。
实现 OutputStream 的 write 方法。
OutputStream 中的 writeb - 要写入的 byte。
IOException - 如果发生 I/O 错误。
public void write(byte[] b,
int off,
int len)
throws IOException
len 字节从指定的初始偏移量为 off 的字节数组写入到该传送输出流。如果某个线程正从连接的传送输入流读取数据字节,但该线程不再处于活动状态,则抛出 IOException。
OutputStream 中的 writeb - 数据。off - 数据中的初始偏移量。len - 要写入的字节数。
IOException - 如果发生 I/O 错误。
public void flush()
throws IOException
Flushable 中的 flushOutputStream 中的 flushIOException - 如果发生 I/O 错误。
public void close()
throws IOException
Closeable 中的 closeOutputStream 中的 closeIOException - 如果发生 I/O 错误。
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。