Is there a non-blocking file read API in java? If not would it be wise to build one in C++ and call it from a java app via JNI?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No,
FileChanneldoes not extendSelectableChannel.Probably because not all OSes support it.
Windows does, and in theory you could write a windows-specific C++ library and call it via JNI, but it is a lot of work to integrate this with
java.nio.I would rather have a worker thread copy the file contents to a pipe and do non-blocking reads on the other end of the pipe.