You 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")
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…