Check out the java.nio.channels package, especially class java.nio.channels.Selector. Note that FileChannel cannot be used with this class since it does not extend SelectableChannel. That's because data from files is regarded as always being available when you ask for it.
pavang kumar wrote:Would that be equivalent to same of the unix select () .Please correct me if i am wrong .
You are wrong. select() has nothing to do with selecting a readable files from a folder, it checks how many of a given set of already open file descriptors (which can also point to sockets or pipes, not just files) have data available.
Can you explain in detail why with FileChannel you don't need to use polling . and any suggestions.
Because FileChannel read operations simply should not block. The contents on the disk are considered to be always available. select() and poll() are to be used with blocking I/O only.
Joined: May 27, 2010
So how should I approach ,well could solve this for me .where i need a select() command similar to unix and can you provide code or any sample program that can make me understand.I will greatly thankful to you.