josx.rcxcomm
Class RCXInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--josx.rcxcomm.RCXInputStream
- public class RCXInputStream
- extends InputStream
RCXInputStream provides an interface similar to FileInputStream.
It is a cut down version of RCXPort, which provides just read access.
Adapted from original code created by the LEGO3 Team at DTU-IAU
- Author:
- Lawrie Griffiths
Method Summary |
int |
available()
Checks if there is any data avaliable on the InputStream |
void |
close()
Close the stream and stop listening |
int |
read()
Read a single byte from the InputStream. |
void |
setTimeout(int timeout)
Setter for timeout |
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- The default buffer size for the InputStream is 32 bytes
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
RCXInputStream
public RCXInputStream()
- Creates new RCXInputStream
setTimeout
public void setTimeout(int timeout)
- Setter for timeout
- Parameters:
timeout
- the timeout
available
public int available()
throws IOException
- Checks if there is any data avaliable on the InputStream
- Overrides:
available
in class InputStream
- Returns:
- The number of bytes avaliable on the InputStream
- Throws:
IOException
- is never thrown
read
public int read()
throws IOException
- Read a single byte from the InputStream. Returns value as
an int value between 0 and 255.
- Overrides:
read
in class InputStream
- Returns:
- A data byte from the stream
- Throws:
IOException
- is thrown when the read is timed out
close
public void close()
- Close the stream and stop listening
- Overrides:
close
in class InputStream
- Following copied from class:
java.io.InputStream
- Throws:
IOException
- if an I/O error occurs.