6526860: (fc) FileChannel.position returns 0 when FileOutputStream opened in append mode

Alan Bateman Alan.Bateman at oracle.com
Thu Feb 17 11:52:31 PST 2011


This one came up on the core-libs-dev mailing list last night [1].  When 
opened for append mode, FileChannel's position() will return 0 if 
invoked prior to writing to the file. It doesn't really make sense to 
use the position methods with files opened for append, the getChannel 
defined by the stream classes does specify that the position be the file 
size when opened for append so this should be fixed. The webrev with the 
changes to fix this are:

http://cr.openjdk.java.net/~alanb/6526860/webrev/

Thanks,
Alan.

[1] 
http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-February/005920.html


More information about the nio-dev mailing list