[Rxtx] IOExcpetion in ParallelOutputStream.write()
Oliver Archner
oliver.archner at bayceer.uni-bayreuth.de
Wed Aug 9 06:13:36 MDT 2006
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)
More information about the Rxtx
mailing list