RFR: 6924219: (fc spec) FileChannel.write(ByteBuffer, position) behavior when file opened for append not specified
Alan Bateman
alanb at openjdk.org
Fri Oct 14 17:33:42 UTC 2022
On Thu, 13 Oct 2022 23:47:54 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Add some verbiage stating that the outcome of invoking the absolute write method `java.nio.channels.write(ByteBuffer,long)` is unspecified when the channel was opened with the `APPEND` option present.
If something has a file opened for append then it's a bug to attempt to write and specify a position. It would be possible to detect this, throw an exception, and thus avoid bugs. However it would be a behavior change. The conservative approach is to specify that it leads to unspecified behavior as you have done.
-------------
PR: https://git.openjdk.org/jdk/pull/10707
More information about the nio-dev
mailing list