Class: java.io.PipedReader
- public class PipedReader
- extends Reader
Piped character-input streams.
Methods
-
PipedReadertop
public PipedReader()Creates aPipedReaderso that it is not yet connected. It must be connected to aPipedWriterbefore being used. -
PipedReadertop
public PipedReader(PipedWriter src) throws IOExceptionCreates aPipedReaderso that it is connected to the piped writersrc. Data written tosrcwill then be available as input from this stream. -
closetop
public void close() throws IOExceptionCloses this piped stream and releases any system resources associated with the stream. -
connecttop
public void connect(PipedWriter src) throws IOExceptionCauses this piped reader to be connected to the piped writersrc. If this object is already connected to some other piped writer, anIOExceptionis thrown.If
srcis an unconnected piped writer andsnkis an unconnected piped reader, they may be connected by either the call:snk.connect(src)or the call:
src.connect(snk)The two calls have the same effect.
-
readtop
public synchronized int read() throws IOExceptionReads the next character of data from this piped stream. If no character is available because the end of the stream has been reached, the value-1is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown. If a thread was providing data characters to the connected piped writer, but the thread is no longer alive, then anIOExceptionis thrown. -
readtop
public synchronized int read(char[] cbuf, int off, int len) throws IOExceptionReads up tolencharacters of data from this piped stream into an array of characters. Less thanlencharacters will be read if the end of the data stream is reached. This method blocks until at least one character of input is available. If a thread was providing data characters to the connected piped output, but the thread is no longer alive, then anIOExceptionis thrown. -
readytop
public synchronized boolean ready() throws IOExceptionTell whether this stream is ready to be read. A piped character stream is ready if the circular buffer is not empty.
