...
The rule FIO01-J. Create files with appropriate access permissions addresses the issue of how to formally indicate specify the permissions of a newly created file.
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
public void createFile_cs(String filename) throws FileNotFoundException{
try (OutputStream out = new BufferedOutputStream(
Files.newOutputStream( Paths.get(filename),
StandardOpenOption.CREATE_NEW))) {
// Work with out
} catch (IOException x) {
// File not writable...handle error
}
} |
...