RFR: 4774868: (fc spec) Unclear spec for FileChannel.force

Alan Bateman alanb at openjdk.java.net
Tue Jan 25 08:00:42 UTC 2022


On Tue, 25 Jan 2022 02:12:38 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add verbiage to `FileChannel.force()` indicating that if the FileChannel is derived from a FileOutputStream or a RandomAccessFile using `getChannel()`, then any modifications made to the channel's file by methods invoked on the parent object will also be forced.

src/java.base/share/classes/java/nio/channels/FileChannel.java line 560:

> 558:      * channel was derived from a {@link FileOutputStream} or
> 559:      * {@link RandomAccessFile} using the {@code getChannel} method,
> 560:      * via the methods defined in those classes.  It may or

This looks okay, I just note that the existing javadoc uses "obtain" rather than "derive". An alternative to consider is "or the methods defined by FOS or RAF when the channel was obtained with the getChannel method".

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

PR: https://git.openjdk.java.net/jdk/pull/7207


More information about the nio-dev mailing list