CentOS java生成文件並賦予權限的問題


2、檢查文件是否允許:

file.canExecute(); – return true, file is executable; false is not.

file.canWrite(); – return true, file is writable; false is not.

file.canRead(); – return true, file is readable; false is not.

3、設置文件權限:

file.setExecutable(boolean); – true, allow execute operations; false to disallow it.

file.setReadable(boolean); – true, allow read operations; false to disallow it.

file.setWritable(boolean); – true, allow write operations; false to disallow it.

Runtime.getRuntime().exec("chmod 777 filename");


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM