public class PipedOutputStream extends OutputStream
PipedOutputStream
对象写一些其他的线程从连接的
PipedInputStream
读。试图从一个线程中使用这两个对象不被推荐,因为它可能会死锁线程。管是
broken 如果一个线程在读数据字节从连接的管道输入流不再活着。
PipedInputStream
Constructor and Description |
---|
PipedOutputStream()
创建一个尚未连接到管道输入流的管道输出流。
|
PipedOutputStream(PipedInputStream snk)
创建连接到指定的管道输入流的管道输出流。
|
Modifier and Type | Method and Description |
---|---|
void |
close()
关闭此管道输出流并释放与此流关联的任何系统资源。
|
void |
connect(PipedInputStream snk)
将此管道输出流连接到接收器。
|
void |
flush()
刷新输出流,使缓存数据被写出来。
|
void |
write(byte[] b, int off, int len)
写
len 字节指定字节数组中的起始偏移
off 这个管道输出流。
|
void |
write(int b)
将指定的输入输出流
byte 。
|
write
public PipedOutputStream(PipedInputStream snk) throws IOException
snk
。
snk
-管道输入流连接。
IOException
如果I/O错误发生。
public PipedOutputStream()
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
。
实现的方法OutputStream
write
。
write
方法重写,继承类
OutputStream
b
-
byte
要写。
IOException
如果管
broken,
unconnected
,关闭,或者如果一个I/O错误发生。
public void write(byte[] b, int off, int len) throws IOException
len
字节指定字节数组中的起始偏移
off
这个管道输出流。此方法块,直到将所有的字节写入输出流为止。
write
方法重写,继承类
OutputStream
b
-数据。
off
的起始偏移量的数据。
len
-字节数写。
IOException
如果管
broken,
unconnected
,关闭,或者如果一个I/O错误发生。
public void flush() throws IOException
flush
接口
Flushable
flush
方法重写,继承类
OutputStream
IOException
如果I/O错误发生。
public void close() throws IOException
close
接口
Closeable
close
接口
AutoCloseable
close
方法重写,继承类
OutputStream
IOException
如果I/O错误发生。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.