Reading data from a unix device Reading data from a unix device unix unix

Reading data from a unix device


Your approach seems sound, but readLine() is very particular about what constitutes a line of text. You might look at the raw stream:

cat /dev/ap | hexdump -C

You could also try read(), as seen in this fragment that reads from /dev/zero:

BufferedReader in = new BufferedReader(new FileReader("/dev/zero"));for (int i = 0; i < 10; i++) {    System.out.print(in.read() + " ");}System.out.println();in.close();

Addendum: For serial I/O, consider RXTX or similar libraries.