On one of my RedHat Linux Servers a couple devices have been setup. /dev/ap and /dev/reuter. They are AP and Reuters news feeds. At the unix command line I can do "cat /dev/ap" and it waits until a message comes down the feed and prints it out to stdout. As soon as there is a pause in the stream cat completes. I tried "more" and got the same results, same with less -f (complete msg, could be luck) and tail -f had no output in an hour.
I know these are streams, but when I try to open a Java BufferReader on new Reader("/dev/ap") I get no output. Using the following run method:
public void run() {
String line = null;
while(true) {
try {
while((line = bsr.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
Couple questions:
1. Are some of the unix commands limited to opening streams from files? e.g. tail?
2. What Am I doing wrong on the Java side that I can't capture the output?
Wrong stream type, wrong wrapper type?
Jim