[Rxtx] IOExcpetion in ParallelOutputStream.write()
Trent Jarvi
tjarvi at qbang.org
Thu Aug 10 18:12:27 MDT 2006
On Wed, 9 Aug 2006, Oliver Archner wrote:
> Dear Users,
>
> i would like to send a byte to a parallel device.
> The following piece of code works well but throws an IOException in
> LPRPort$ParallelOutputStream.write() saying that everything is ok ?!
>
> Oliver
>
>
> import java.io.*;
> import gnu.io.*;
>
> public class Test {
>
> public static void main(String[] args) {
> RXTXCommDriver TxPort = new RXTXCommDriver();
> ParallelPort pPort = (ParallelPort) TxPort.getCommPort("LPT1",
> CommPortIdentifier.PORT_PARALLEL);
> OutputStream oStream = null;
> try {
> oStream = pPort.getOutputStream();
> oStream.write((byte)0x51);
> } catch (IOException e) {
> e.printStackTrace();
> } finally {
> try {
> if (oStream != null) oStream.close();
> } catch (IOException e) {
> e.printStackTrace();
>
> }
> }
>
> }
> }
>
> Output:
>
> Stable Library
> =========================================
> Native lib Version = RXTX-2.1-7
> Java lib Version = RXTX-2.1-7
> java.io.IOException: Der Vorgang wurde erfolgreich beendet.
> in writeByte
> at gnu.io.LPRPort.writeByte(Native Method)
> at gnu.io.LPRPort$ParallelOutputStream.write(LPRPort.java:281)
> at Test.main(Test.java:12)
WriteFile is returning a negative value or 0. I do not know what that
exception is saying but it should be an IO Exception.
The native code in question is line 405 in ParallelImp.c. If you find the
documentation pointing out how the code is wrong, we can fix it.
--
Trent Jarvi
tjarvi at qbang.org
More information about the Rxtx
mailing list