Modifier and Type | Field and Description |
---|---|
pack-priv char[] | buffer
The circular buffer into which incoming data is placed. |
pack-priv boolean | |
pack-priv boolean | |
pack-priv boolean | |
private static final int | DEFAULT_PIPE_SIZE
The size of the pipe's circular input buffer. |
pack-priv int | in
The index of the position in the circular buffer at which the next character of data will be stored when received from the connected piped writer. |
pack-priv int | out
The index of the position in the circular buffer at which the next character of data will be read by this piped reader. |
pack-priv Thread | |
pack-priv Thread |
Access | Constructor and Description |
---|---|
public | PipedReader(PipedWriter
the stream to connect to. src)Creates a |
public | PipedReader(PipedWriter
the stream to connect to. src, int the size of the pipe's buffer. pipeSize)Creates a |
public | |
public | PipedReader(int
the size of the pipe's buffer. pipeSize)Creates a |
Modifier and Type | Method and Description |
---|---|
public void | close()
Implements abstract java. Implements java. Closes this piped stream and releases any system resources associated with the stream. |
public void | connect(PipedWriter
The piped writer to connect to. src)Causes this piped reader to be connected
to the piped writer |
private void | |
public synchronized int | Returns: the next character of data, or-1 if the end of the
stream is reached.Overrides java. Reads the next character of data from this piped stream. |
public synchronized int | Returns: The number of characters read, or -1 if the end of the stream has been reachedDestination buffer cbuf, int Offset at which to start storing characters off, int Maximum number of characters to read len)Implements abstract java. Reads characters into a portion of an array. |
public synchronized boolean | |
pack-priv synchronized void | |
pack-priv synchronized void | |
pack-priv synchronized void |
buffer | back to summary |
---|---|
pack-priv char[] buffer The circular buffer into which incoming data is placed. |
closedByReader | back to summary |
---|---|
pack-priv boolean closedByReader |
closedByWriter | back to summary |
---|---|
pack-priv boolean closedByWriter |
connected | back to summary |
---|---|
pack-priv boolean connected |
DEFAULT_PIPE_SIZE | back to summary |
---|---|
private static final int DEFAULT_PIPE_SIZE The size of the pipe's circular input buffer. |
in | back to summary |
---|---|
pack-priv int in The index of the position in the circular buffer at which the
next character of data will be stored when received from the connected
piped writer. |
out | back to summary |
---|---|
pack-priv int out The index of the position in the circular buffer at which the next character of data will be read by this piped reader. |
readSide | back to summary |
---|---|
pack-priv Thread readSide |
writeSide | back to summary |
---|---|
pack-priv Thread writeSide |
PipedReader | back to summary |
---|---|
public PipedReader(PipedWriter src) throws IOException Creates a
|
PipedReader | back to summary |
---|---|
public PipedReader(PipedWriter src, int pipeSize) throws IOException Creates a
|
PipedReader | back to summary |
---|---|
public PipedReader() Creates a |
PipedReader | back to summary |
---|---|
public PipedReader(int pipeSize) Creates a
|
close | back to summary |
---|---|
public void close() throws IOException Implements abstract java. Implements java. Closes this piped stream and releases any system resources associated with the stream.
|
connect | back to summary |
---|---|
public void connect(PipedWriter src) throws IOException Causes this piped reader to be connected
to the piped writer
If snk.connect(src) or the call: src.connect(snk) The two calls have the same effect.
|
initPipe | back to summary |
---|---|
private void initPipe(int pipeSize) |
read | back to summary |
---|---|
public synchronized int read() throws IOException Overrides java. Reads 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
|
read | back to summary |
---|---|
public synchronized int read(char[] cbuf, int off, int len) throws IOException Implements abstract java. Doc from java. Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached. If Fewer than
|
ready | back to summary |
---|---|
public synchronized boolean ready() throws IOException Overrides java. Tell whether this stream is ready to be read. A piped character stream is ready if the circular buffer is not empty.
|
receive | back to summary |
---|---|
pack-priv synchronized void receive(int c) throws IOException Receives a char of data. This method will block if no input is available. |
receive | back to summary |
---|---|
pack-priv synchronized void receive(char[] c, int off, int len) throws IOException Receives data into an array of characters. This method will block until some input is available. |
receivedLast | back to summary |
---|---|
pack-priv synchronized void receivedLast() Notifies all waiting threads that the last character of data has been received. |