public class PipedWriter extends Writer
| Constructor and Description |
|---|
PipedWriter()
创建一个尚未连接到管道读取器的管道写入器。
|
PipedWriter(PipedReader snk)
创建连接到指定管道读取器的管道写入器。
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
关闭此管道输出流,并释放与此流相关联的任何系统资源。
|
void |
connect(PipedReader snk)
将此管道写入器连接到接收器。
|
void |
flush()
刷新此输出流并强制任何缓冲的输出字符被写出。
|
void |
write(char[] cbuf, int off, int len)
从指定的字符数组写入
len字符,从偏移量
off开始
off到这个管道输出流。
|
void |
write(int c)
写入指定
char到管道输出流。
|
public PipedWriter(PipedReader snk) throws IOException
snk 。
snk - 连接到管道阅读器。
IOException - 如果发生I / O错误。
public PipedWriter()
public void connect(PipedReader snk) throws IOException
IOException 。
如果snk是未连接的管道读写器,并且src是未连接的管道写入器,则可以通过以下任一方式连接它们:
或电话:src.connect(snk)
两个电话有相同的效果。snk.connect(src)
snk - 连接到管道阅读器。
IOException - 如果发生I / O错误。
public void write(int c)
throws IOException
char到管道输出流。
如果线程正在从连接的管道输入流中读取数据字符,但线程不再存在,则抛出IOException 。
实现write方法Writer 。
write在类别
Writer
c -
char 。
IOException -如果管道是
broken ,
unconnected ,关闭或发生I / O错误。
public void write(char[] cbuf,
int off,
int len)
throws IOException
len字符,从偏移off开始输出到这个管道输出流。
该方法阻塞,直到所有字符被写入输出流。
如果一个线程正在从连接的管道输入流中读取数据字符,但线程不再存在,则抛出IOException 。
write在类别
Writer
cbuf - 数据。
off - 数据中的起始偏移量。
len - 要写入的字符数。
IOException -如果管道是
broken ,
unconnected ,关闭或发生I / O错误。
public void flush()
throws IOException
flush在界面
Flushable
flush在类别
Writer
IOException - 如果管道关闭或发生I / O错误。
public void close()
throws IOException
close在界面
Closeable
close在界面
AutoCloseable
close在类别
Writer
IOException - if an I/O error occurs.
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.