RFR: 6924219: (fc spec) FileChannel.write(ByteBuffer, position) behavior when file opened for append not specified

Brian Burkhalter bpb at openjdk.org
Fri Oct 14 17:08:19 UTC 2022


On Fri, 14 Oct 2022 17:02:57 GMT, Alan Bateman <alanb 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.
>
> src/java.base/share/classes/java/nio/channels/FileChannel.java line 151:
> 
>> 149:  * therefore unspecified.  In this mode an invocation of the {@linkplain
>> 150:  * #write(ByteBuffer,long) absolute write} operation leads to unspecified
>> 151:  * behavior.
> 
> I'm not sure about the phrase "absolute write" as we haven't used that before. I think it might be better to say something like "In this mode, the behavior of the method to write at a given position is also system-dependent".

I was keying off the expression "In this mode each invocation of a relative write operation" earlier in the same paragraph and also in analogy to absolute and relative operations in `Buffer`. That said, I don't disagree with the comment.

-------------

PR: https://git.openjdk.org/jdk/pull/10707


More information about the nio-dev mailing list