com.dalsemi.comm
Class SerialInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--com.dalsemi.comm.SerialInputStream
- public class SerialInputStream
- extends InputStream
A Serial input stream is an input stream for reading data from an serial port.
Method Summary |
int |
available()
Returns the number of bytes that can be read from this input
stream without blocking. |
void |
close()
Closes this Serial input stream and releases any system resources
associated with the stream. |
protected void |
disableReceiveThreshold()
|
protected void |
enableReceiveThreshold(int thresh)
|
protected int |
getReceiveThreshold()
|
protected boolean |
isReceiveThresholdEnabled()
|
protected void |
open()
Opens the Serial input stream for reading. |
int |
read()
Reads the next byte of data from this input stream. |
int |
read(byte[] barr,
int offset,
int len)
Reads the number of bytes requested from this input stream. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
open
protected void open()
throws IOException
- Opens the Serial input stream for reading.
- Throws:
- IOException - if an I/O error occurs.
read
public int read()
throws IOException
- Reads the next byte of data from this input stream. The value
byte is returned as an
int
in the range
0
to 255
. If no byte is available
because the end of the stream has been reached, the value
-1
is returned. This method blocks until input data
is available, the end of the stream is detected, or an exception
is thrown.
- Overrides:
- read in class InputStream
- Returns:
- the next byte of data, or
-1
if the end of the
stream is reached. - Throws:
- IOException - if an I/O error occurs.
read
public int read(byte[] barr,
int offset,
int len)
throws IOException
- Reads the number of bytes requested from this input stream.
If no byte is available
because the end of the stream has been reached, the value
-1
is returned. This method blocks until input data
is available, the end of the stream is detected, or an exception
is thrown.
- Overrides:
- read in class InputStream
- Parameters:
barr
- the array to be filled.offset
- the offset to begin writting in the array.len
- the number of bytes requested.- Returns:
- the number of bytes read or
-1
if the end of the stream
has been reached. - Throws:
- IOException -
- See Also:
close
public void close()
throws IOException
- Closes this Serial input stream and releases any system resources
associated with the stream.
- Overrides:
- close in class InputStream
- Throws:
- IOException - if an I/O error occurs.
available
public int available()
throws IOException
- Returns the number of bytes that can be read from this input
stream without blocking. The available method of
InputStream
returns 0
. This method
should be overridden by subclasses.
- Overrides:
- available in class InputStream
- Returns:
- the number of bytes that can be read from this input stream
without blocking.
- Throws:
- IOException - if an I/O error occurs.
enableReceiveThreshold
protected void enableReceiveThreshold(int thresh)
throws javax.comm.UnsupportedCommOperationException
getReceiveThreshold
protected int getReceiveThreshold()
disableReceiveThreshold
protected void disableReceiveThreshold()
isReceiveThresholdEnabled
protected boolean isReceiveThresholdEnabled()