8221397: Support implementation-defined Map Modes

Allow implementation-defined extensions to FileChannel MapMode enum

Reviewed-by: alanb
This commit is contained in:
Andrew Dinn 2019-04-09 16:21:20 +01:00
parent 4a477cabd8
commit 1c7d214f53
2 changed files with 27 additions and 13 deletions

View file

@ -940,14 +940,15 @@ public class FileChannelImpl
if (size > Integer.MAX_VALUE)
throw new IllegalArgumentException("Size exceeds Integer.MAX_VALUE");
int imode = -1;
int imode;
if (mode == MapMode.READ_ONLY)
imode = MAP_RO;
else if (mode == MapMode.READ_WRITE)
imode = MAP_RW;
else if (mode == MapMode.PRIVATE)
imode = MAP_PV;
assert (imode >= 0);
else
throw new UnsupportedOperationException();
if ((mode != MapMode.READ_ONLY) && !writable)
throw new NonWritableChannelException();
if (!readable)