--- old/src/java.base/share/classes/java/nio/channels/FileChannel.java 2018-07-25 11:31:32.829933700 +0100 +++ new/src/java.base/share/classes/java/nio/channels/FileChannel.java 2018-07-25 11:31:32.557932889 +0100 @@ -817,6 +817,18 @@ public static final MapMode PRIVATE = new MapMode("PRIVATE"); + /** + * Mode for a read-only mapping from a non-volatile device. + */ + public static final MapMode READ_ONLY_PERSISTENT + = new MapMode("READ_ONLY_PERSISTENT"); + + /** + * Mode for a read/write mapping from a non-volatile device. + */ + public static final MapMode READ_WRITE_PERSISTENT + = new MapMode("READ_WRITE_PERSISTENT"); + private final String name; private MapMode(String name) { @@ -889,10 +901,12 @@ * * @param mode * One of the constants {@link MapMode#READ_ONLY READ_ONLY}, {@link - * MapMode#READ_WRITE READ_WRITE}, or {@link MapMode#PRIVATE - * PRIVATE} defined in the {@link MapMode} class, according to + * MapMode#READ_WRITE READ_WRITE}, {@link MapMode#PRIVATE + * PRIVATE}, {@link MapMode#READ_ONLY_PERSISTENT READ_ONLY_PERSISTENT} + * or {@link MapMode#READ_WRITE_PERSISTENT READ_WRITE_PERSISTENT} defined in the {@link MapMode} class, according to * whether the file is to be mapped read-only, read/write, or - * privately (copy-on-write), respectively + * privately (copy-on-write), read-only from a non-volatile + * device or read-write from a non-volatile device, respectively * * @param position * The position within the file at which the mapped region @@ -905,13 +919,14 @@ * @return The mapped byte buffer * * @throws NonReadableChannelException - * If the {@code mode} is {@link MapMode#READ_ONLY READ_ONLY} but + * If the {@code mode} is {@link MapMode#READ_ONLY READ_ONLY} or + * {@link MapMode#READ_ONLY_PERSISTENT READ_ONLY_PERSISTENT} but * this channel was not opened for reading * * @throws NonWritableChannelException - * If the {@code mode} is {@link MapMode#READ_WRITE READ_WRITE} or - * {@link MapMode#PRIVATE PRIVATE} but this channel was not opened - * for both reading and writing + * If the {@code mode} is {@link MapMode#READ_WRITE READ_WRITE}, + * {@link MapMode#PRIVATE PRIVATE} or {@link MapMode#READ_WRITE_PERSISTENT READ_WRITE_PERSISTENT} + * but this channel was not opened for both reading and writing * * @throws IllegalArgumentException * If the preconditions on the parameters do not hold