This content has been marked as final. Show 4 replies
SocketChannel.write() in blocking mode and FileChannel.write() should both write as much data as there is to write. That's how the underlying operating system write() APIs work, so there is no opportunity for Java to change it. In non-blocking mode, SocketChannel.write() writes as much of the data as will fit into the socket send buffer, and this can vary from write to write, let alone JDK to JDK.
Contrary to the implication in the Javadoc, the implementations of transferTo() and transferFrom() in 1.6 did not call OS transfer functions directly: they are read/write loops at the Java level. It is entirely possible that this implementation has changed in 1.7.
However it is certainly true that you have to check the return values of these methods and react accordingly. Any code that doesn't do so is incorrect.
932845 wrote:If it changed and if it is documented then it would be in the release notes.
... and whether this is documented.
I would be more interested in hearing from anyone of the java development or support teamOnly sure way and only likely way that is going to happen is if you have a sales/monetary relationship with Oracle and you use that relationship to ask your question.