About Question enthuware.ocpjp.v8.2.1552 :
Posted: Mon Dec 14, 2015 10:51 am
I'm working on Java 1.8.0_45. invokes
where you can find
In fact, all the five options compile in my jre/os. Anyway, being there hardcoded in the class, I think it can be considered a general rule in case of reading.
Code: Select all
Files.newInputStream(Path path, OpenOption... options)
Code: Select all
FileSystemProvider.newInputStream(Path path, OpenOption... options)
Code: Select all
for (OpenOption opt: options) {
// All OpenOption values except for APPEND and WRITE are allowed
if (opt == StandardOpenOption.APPEND ||
opt == StandardOpenOption.WRITE)
throw new UnsupportedOperationException("'" + opt + "' not allowed");
}