|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Input source that supports read with timeouts. If timeout occurs before any data is available, TimeoutException is thrown.
Method Summary | |
int |
timedRead(byte[] buf,
int off,
int len,
long timeout)
Reads up to len bytes of data from the input stream into
an array of bytes. |
int |
timedRead(byte[] buf,
long timeout)
Reads some number of bytes of data from the input stream into an array of bytes. |
int |
timedRead(long timeout)
Read a byte of data if available within specified timeout. |
Methods inherited from interface edu.emory.mathcs.util.io.Input |
available, close, mark, markSupported, read, read, read, reset, skip |
Method Detail |
public int timedRead(long timeout) throws java.io.IOException, TimeoutException
timeout
- the number of milliseconds to wait for data
java.io.IOException
- if an I/O error occurs
TimeoutException
- if timeout occurs before data is availableInputStream.read()
public int timedRead(byte[] buf, long timeout) throws java.io.IOException, TimeoutException
buf.length
bytes, but a smaller number may be read.
The number of bytes actually read is returned as an integer.
If buf
has nonzero size but no data is available within the
specified timeout and the stream is not at EOF, TimeoutException is
thrown.
buf
- the buffer into which the data is readtimeout
- the maximum number of milliseconds to wait before data
is available
java.io.IOException
- if an I/O error occurs
TimeoutException
- if timeout occurs before data is availableInputStream.read(byte[])
public int timedRead(byte[] buf, int off, int len, long timeout) throws java.io.IOException, TimeoutException
len
bytes of data from the input stream into
an array of bytes. An attempt is made to read as many as
len
bytes, but a smaller number may be read.
The number of bytes actually read is returned as an integer.
If nonzero bytes is requested but no data is available within the
specified timeout and the stream is not at EOF, TimeoutException is
thrown.
buf
- the buffer into which the data is readoff
- the start offset in array buf
where data
is writtenlen
- the maximum number of bytes to readtimeout
- the maximum number of milliseconds to wait before data
is available
java.io.IOException
- if an I/O error occurs
TimeoutException
- if timeout occurs before data is availableInputStream.read(byte[],int,int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |