StandardOpenOption Arguments

Cards (6)

  • WRITE = Opens the file for writing.
  • APPEND = Appends new data to the end of the file; use this option with WRITE or CREATE
  • TRUNCATE_EXISTING = Truncates the existing file to 0 byte so the file contents are replaced; use this option with the WRITE option.
  • CREATE_NEW = Creates new file only if it hasn't existed yet; it throws an exception if the file already exists.
  • CREATE = Opens the file if it exists or creates a new file if it hasn't existed yet.
  • DELETE_ON_CLOSE = Deletes the file when the stream is closed; it is used most often for temporary files that exist only for duration of the program.