code: void write(String prefix, File catalog) throws IOException {
  		File backup = File.createTempFile(prefix, null, catalog.getParentFile());
  		if (catalog.exists()) {
  			// Create a copy of the current state
  			Files.copy(catalog.toPath(), backup.toPath(), StandardCopyOption.REPLACE_EXISTING);
  		}
  
  		// Update the file
  		try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(catalog))) {
  			oos.writeObject(this);
  			backup.delete();
  		} catch (IOException e) {
  			try {
  				Files.move(backup.toPath(), catalog.toPath(), StandardCopyOption.ATOMIC_MOVE);
  			} catch (IOException e2) {
  				logger.log(Level.INFO, "A backup has been saved at: " + backup, e2);
  			}
  			throw new IOException("Failed to update file: " + catalog, e);
  		}
  	}
docs: Writes the inventory to the specified file. See also {@link #read(File)}.
  @param prefix the file prefix for a temporary backup file
  @param catalog the file to write to
  @throws IOException if the file could not be updated