AsynchronousSocketChannel write()
Alan Bateman
Alan.Bateman at oracle.com
Mon Aug 23 11:36:09 PDT 2010
Avinash Lakshman wrote:
> Got it. However please correct me if I am wrong. Can't the JDK level
> API implementation take care of handling incomplete writes/reads and
> call the completion handler only on true I/O completion. That is the
> way things work in Windows I/O completion ports. Wouldn't that be a
> cleaner and trueer asynchronous model?
The result of readFully would still need to be the number of bytes read
as it may not be possible to fill the buffer (EOF, I/O error after
reading some data, ...). A writeFully makes more sense but may require
to do multiple writes and so it's going to be too much different to how
you would implement it yourself. Maybe this is something to think about
for the future.
-Alan.
More information about the nio-discuss
mailing list