[Rxtx] Underlying input stream returned zero bytes
Trent Jarvi
tjarvi at qbang.org
Thu Sep 21 18:45:23 MDT 2006
On Thu, 21 Sep 2006, TEIXOEIRA at terra.es wrote:
>
> Hi, there.
> I'm having difficulties reading a serial line with RXTX 2.1-7 on Windows XP, I can communicate through this serial line using
> HiperTerminal though.
> Also, I can't find any clues about this issue on the internet. Can anybody tell what might cause this exception while reading?
>
> Kind regards.
>
> java.io.IOException: Underlying input stream returned zero bytes
> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415)
> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
> at java.io.InputStreamReader.read(InputStreamReader.java:167)
> at java.io.BufferedReader.fill(BufferedReader.java:136)
> at java.io.BufferedReader.readLine(BufferedReader.java:299)
> at java.io.BufferedReader.readLine(BufferedReader.java:362)
>
>
>
> Prueba el correo Terra ( http://www.terra.es/correo ); Seguro, rápido, fiable.
>
>
Hello,
It is perfectly normal for rxtx to return zero bytes depending upon how
the timeout and threshold are set. If you do not want the read to
timeout, set it to zero.
*timeout threshold Behavior
*------------------------------------------------------------------------
*0 0 blocks until 1 byte is available timeout > 0,
* threshold = 0, blocks until timeout occurs, returns -1
* on timeout
*>0 >0 blocks until timeout, returns - 1 on timeout, magnitude
* of threshold doesn't play a role.
*0 >0 Blocks until 1 byte, magnitude of threshold doesn't
* play a role
I do not think defaults are documented so do not assume that they are the
same between rxtx and sun.
--
Trent Jarvi
tjarvi at qbang.org
More information about the Rxtx
mailing list