|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
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 的指定 byte 陣列寫入該管道輸出串流。 |
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 寫入傳送的輸出串流。
實作 OutputStream 的 write 方法。
OutputStream 中的 writeb - 要寫入的 byte。
IOException - 如果管道處於毀壞或未連接狀態,或者發生 I/O 錯誤。
public void write(byte[] b,
int off,
int len)
throws IOException
len 位元組從初始偏移量為 off 的指定 byte 陣列寫入該管道輸出串流。在將所有位元組寫入輸出串流之前,此方法一直處於阻塞狀態。
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. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。