As the title suggests, I'd like to know what is Java's equivalent (or most similar) function to C's poll()
function for polling a set of file descriptors?
Java equivalent of C's poll()?
Asked Answered
As @EJP has commented above for java.nio.channels.Selector
A Selector supports key-based, non-blocking, multiplexed I/O. In other words, selectors enable you to perform I/O through multiple channels. Selectors are most applicable to socket-backed channels.
It is better to take a look at javadoc for java.nio.channels.Selector.
This is available since Java ( 7 ) 1.4 and later
The docu says Since: 1.4 – I guess its only NIO and not NIO.2 –
Freeforall
The Selector only works with network sockets and pipes, but the question is about files. –
Gualtiero
© 2022 - 2024 — McMap. All rights reserved.
java.nio
– Rihana