< prev index next >
src/java.base/share/classes/java/nio/channels/FileChannel.java
Print this page
@@ -815,10 +815,22 @@
* Mode for a private (copy-on-write) mapping.
*/
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) {
this.name = name;
}
@@ -887,14 +899,16 @@
* standpoint of performance it is generally only worth mapping relatively
* large files into memory. </p>
*
* @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
* is to start; must be non-negative
*
@@ -903,17 +917,18 @@
* no greater than {@link java.lang.Integer#MAX_VALUE}
*
* @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
*
* @throws IOException
< prev index next >