Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: minor

...

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
bgColor#ccccff
langjava
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
  }
} 

...