Create a read-only file

前端 未结 7 1984
我寻月下人不归
我寻月下人不归 2021-01-14 01:24

I was wondering wether it is possible to create or simulate a file with a content set at creation and the assurance that nobody can ever change the file. If possible, can I

7条回答
  •  感情败类
    2021-01-14 02:10

    Try:

    • file.setReadOnly()
    • Runtime.getRuntime().exec("attrib " + "" + file.getAbsolutePath() + "" + " +R"); //(works on Windows)

提交回复
热议问题