I'm using a bufferedReader to read from a FIFO queue, data is put in the FIFO queue by a C program that reads from a UART to get data (the C program isn't running yet, so I'm using echo "test" > MY_FIFO
to test).
I want my java program to block until there is data, and only execute when there is data. It does this the first time, but once something is put in the fifo, fif.readLine()
repeatedly returns null.
Is there any way to 'reset' the bufferedReader so that it blocks again on the next call to readLine()
? The only workaround I can think of at the moment is re-initializing the reader after reading from it.
edit : The queue I am using is a FIFO queue (a file) created by a call to mkfifo()