--- a/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java Wed Feb 16 12:38:13 2011 +0000
+++ b/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java Thu Feb 17 20:50:22 2011 +0000
@@ -51,6 +51,7 @@
// File access mode (immutable)
private final boolean writable;
private final boolean readable;
+ private final boolean append;
// Required to prevent finalization of creating stream (immutable)
private final Object parent;
@@ -67,6 +68,7 @@
this.fd = fd;
this.readable = readable;
this.writable = writable;
+ this.append = append;
this.parent = parent;
this.nd = new FileDispatcherImpl(append);
}
@@ -242,7 +244,8 @@
if (!isOpen())
return 0;
do {
- p = position0(fd, -1);
+ // in append-mode then position is advanced to end before writing
+ p = (append) ? nd.size(fd) : position0(fd, -1);
} while ((p == IOStatus.INTERRUPTED) && isOpen());
return IOStatus.normalize(p);
} finally {