VMChannel.write(ByteBuffer src, int pos, int len) will return a wrong number of bytes written when (len=1).
When (len=1), the method calls Filesystem.writeByte(...) and considers the returned value as a number of bytes written. Problem is Filesystem.writeByte() returns an "OK" status (0 <=> one byte written, otherwise an error occurred). Thus the current implementation reports 0 byte written when the writeByte operation succeed.
The bug is located at libraryInterface/GNUClasspath/LGLP/src/gnu/java/nio/VMChannel.java:411
A possible fix:
change the following line
bytes = FileSystem.writeByte(nfd.getNativeFD(),src.get(pos));
by the following line
bytes = ( FileSystem.writeByte(nfd.getNativeFD(),src.get(pos)) == 0 ? 1 : 0 )
This solution however doesn't take care of a possible error status returned.