151 |
* This method receives a byte of input from the source PipedOutputStream. |
* This method receives a byte of input from the source PipedOutputStream. |
152 |
* If the internal circular buffer is full, this method blocks. |
* If the internal circular buffer is full, this method blocks. |
153 |
* |
* |
154 |
* @param byte_received The byte to write to this stream |
* @param val The byte to write to this stream |
155 |
* |
* |
156 |
* @exception IOException if error occurs |
* @exception IOException if error occurs |
157 |
* @specnote Weird. This method must be some sort of accident. |
* @specnote Weird. This method must be some sort of accident. |
158 |
*/ |
*/ |
159 |
protected synchronized void receive(int b) throws IOException |
protected synchronized void receive(int val) throws IOException |
160 |
{ |
{ |
161 |
read_buf[0] = (byte) (b & 0xff); |
read_buf[0] = (byte) (val & 0xff); |
162 |
receive (read_buf, 0, 1); |
receive (read_buf, 0, 1); |
163 |
} |
} |
164 |
|
|
237 |
* because the end of the stream was reached. If the stream is already |
* because the end of the stream was reached. If the stream is already |
238 |
* closed, a -1 will again be returned to indicate the end of the stream. |
* closed, a -1 will again be returned to indicate the end of the stream. |
239 |
* <p> |
* <p> |
240 |
* This method will block if no bytes are available to be read. |
* This method will block if no byte is available to be read. |
|
* |
|
|
* @param buf The buffer into which bytes will be stored |
|
|
* @param offset The index into the buffer at which to start writing. |
|
|
* @param len The maximum number of bytes to read. |
|
241 |
*/ |
*/ |
242 |
public int read() throws IOException |
public int read() throws IOException |
243 |
{ |
{ |
248 |
// if this method is never called. |
// if this method is never called. |
249 |
|
|
250 |
int r = read(read_buf, 0, 1); |
int r = read(read_buf, 0, 1); |
251 |
|
return r != -1 ? read_buf[0] : -1; |
|
if (r == -1) |
|
|
return -1; |
|
|
else |
|
|
return read_buf[0]; |
|
252 |
} |
} |
253 |
|
|
254 |
/** |
/** |