1 |
/* PipedInputStream.java -- Read portion of piped streams. |
/* PipedInputStream.java -- Read portion of piped streams. |
2 |
Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
226 |
} |
} |
227 |
|
|
228 |
/** |
/** |
229 |
* This method reads bytes from the stream into a caller supplied buffer. |
* This method reads one byte from the stream. |
230 |
* It starts storing bytes at position <code>offset</code> into the |
* -1 is returned to indicated that no bytes can be read |
|
* buffer and |
|
|
* reads a maximum of <code>len</code> bytes. Note that this method |
|
|
* can actually |
|
|
* read fewer than <code>len</code> bytes. The actual number of bytes |
|
|
* read is |
|
|
* returned. A -1 is returned to indicated that no bytes can be read |
|
231 |
* 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 |
232 |
* 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. |
233 |
* <p> |
* |
234 |
* This method will block if no byte is available to be read. |
* <p>This method will block if no byte is available to be read.</p> |
235 |
|
* |
236 |
|
* @return the value of the read byte value, or -1 of the end of the stream |
237 |
|
* was reached |
238 |
|
* |
239 |
|
* @throws IOException if an error occured |
240 |
*/ |
*/ |
241 |
public int read() throws IOException |
public int read() throws IOException |
242 |
{ |
{ |
247 |
// if this method is never called. |
// if this method is never called. |
248 |
|
|
249 |
int r = read(read_buf, 0, 1); |
int r = read(read_buf, 0, 1); |
250 |
return r != -1 ? read_buf[0] : -1; |
return r != -1 ? (read_buf[0] & 0xff) : -1; |
251 |
} |
} |
252 |
|
|
253 |
/** |
/** |