I'm new to Java. Where is umask exposed in the api?
See Question&Answers more detail:osYou can't fiddle with the umask directly, since Java is an abstraction and the umask is POSIX-implementation specific. But you have the following API:
File f;
f.setExecutable(true);
f.setReadable(false);
f.setWritable(true);
There are some more APIs available, check the docs.
If you must have direct access to the umask, either do it via JNI and the chmod()
syscall, or spawn a new process with exec("chmod")
.