OldSerialPort.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13: package xeij;
14:
15: import java.io.*;
16:
17: public class OldSerialPort implements AutoCloseable {
18:
19: private long wp;
20: private SerialInputStream inputStream;
21: private SerialOutputStream outputStream;
22:
23: @Override public native void close () throws IOException;
24: public native SerialInputStream getInputStream () throws IOException;
25: public native SerialOutputStream getOutputStream () throws IOException;
26: public native String getPortName () throws IOException;
27: public native final void open (String str) throws IOException;
28: public native final void open (int vid, int pid) throws IOException;
29: public native void speed (String str) throws IOException;
30:
31: public class SerialInputStream extends InputStream {
32: private long wp;
33: @Override public native int available () throws IOException;
34: @Override public native void close () throws IOException;
35: @Override public native int read () throws IOException;
36: }
37:
38: public class SerialOutputStream extends OutputStream {
39: private long wp;
40: @Override public native void close () throws IOException;
41: @Override public native void write (int b) throws IOException;
42: }
43:
44: public OldSerialPort (String str) throws IOException {
45: open (str);
46: }
47: public OldSerialPort (int vid, int pid) throws IOException {
48: open (vid, pid);
49: }
50:
51: }