public class PipedReader extends Reader
| Constructor and Description |
|---|
PipedReader()
创建一个
PipedReader ,所以它还不是
connected 。
|
PipedReader(int pipeSize)
创建一个
PipedReader ,使其尚未
connected并使用指定的管道大小作为管道的缓冲区。
|
PipedReader(PipedWriter src)
创建一个
PipedReader ,使其连接到管道写入器
src 。
|
PipedReader(PipedWriter src, int pipeSize)
创建一个
PipedReader ,使其连接到管道写入器
src ,并使用指定的管道大小作为管道的缓冲区。
|
public PipedReader(PipedWriter src) throws IOException
PipedReader ,使其连接到管道写入器src 。
写入src数据将作为此流的输入。
src - 要连接的流。
IOException - 如果发生I / O错误。
public PipedReader(PipedWriter src, int pipeSize) throws IOException
PipedReader ,使其连接到管道写入器src ,并为管道缓冲区使用指定的管道大小。
写入src数据将作为此流的输入。
src - 要连接的流。
pipeSize - 管道缓冲区的大小。
IOException - 如果发生I / O错误。
IllegalArgumentException - 如果
pipeSize <= 0 。
public PipedReader()
public PipedReader(int pipeSize)
pipeSize - 管道缓冲区的大小。
IllegalArgumentException - 如果
pipeSize <= 0 。
public void connect(PipedWriter src) throws IOException
src 。
如果此对象已连接到其他管道写入器,则抛出IOException 。
如果src是未连接的管道写入器,并且snk是未连接的管道读取器,则可以通过以下任一方式连接它们:
snk.connect(src)
或电话:
src.connect(snk)
两个电话有相同的效果。
src - 连接到管道写入器。
IOException - 如果发生I / O错误。
public int read()
throws IOException
-1 。
该方法阻塞直到输入数据可用,检测到流的结尾,或抛出异常。
read在类别
Reader
-1 。
IOException -如果管道是
broken ,
unconnected ,关闭,或发生I / O错误。
public int read(char[] cbuf,
int off,
int len)
throws IOException
len字符数组。
如果达到数据流的结尾,或者如果len超过管道的缓冲区大小,则读取少于len字符。
该方法阻塞,直到输入的至少一个字符可用。
read在
Reader
cbuf - 读取数据的缓冲区。
off - 数据的起始偏移量。
len - 读取的最大字符数。
-1如果没有更多的数据,因为流已经到达。
IOException -如果管道是
broken ,
unconnected ,关闭,或发生I / O错误。
public boolean ready()
throws IOException
ready在类别
Reader
IOException -如果管道是
broken ,
unconnected ,或关闭。
public void close()
throws IOException
close在界面
Closeable
close在界面
AutoCloseable
close在类别
Reader
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.