Create a read-only file

前端 未结 7 2049
我寻月下人不归
我寻月下人不归 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 01:55

    In this case simply you have to create a file using File class after that by reference you have to call setReadOnly() method.

        File f=new File("abc.txt");
        f.setReadOnly();
    

提交回复
热议问题