Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Blocking read on a FIFO

843789Mar 10 2010 — edited Mar 10 2010
My java program needs to read data from a FIFO file and then block when the data ends and wait for more data.

I can achieve the desired effect with something like
while(true) {
    while(myReader.ready()) {
        ... read data here ....
    }
}
... but this eats the cpu. Is there a way to truly do a blocking read on the file while waiting for more data?

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2010
Added on Mar 10 2010
3 comments
247 views