Save properties to a file.

@param file
Destination file - Cannot be <code>null</code> and parent directory must exist.
@param props
Properties to save - Cannot be <code>null</code>.
@param comment
Comment for the file.
9171
public static void saveProperties(final File file, final Properties props, final String comment) {
        checkNotNull("file", file);
        checkNotNull("props", props);

        if (!file.getParentFile().exists()) {
            throw new IllegalArgumentException("The parent directory '" + file.getParentFile() + "' does not exist [file='" + file + "']!");
        }
        try (final OutputStream outStream = new FileOutputStream(file)) {
            props.store(outStream, comment);
        } catch (final IOException ex) {
            throw new RuntimeException(ex);
        }
    }
266126
public void save(Map<String, Object> properties) throws PropertyException {
		try {
			mWriter.save(properties);
		} catch (IOException e) {
			throw new PropertyException(e.getMessage());
		}
	}
611274
public void saveTo(File file) throws IOException {
		FileWriter writer = new FileWriter(file);
		try {
			writer.write(getAbcString());
		} finally {
			writer.close();
		}
	}
24179
@Override
    public void setFile(File file) {
        configFile = file;
        if (tc.isDebugEnabled())
            Tr.debug(tc, "Jaspi configuration of persistent providers will be stored in file: " + file);
    }
450504
public static Properties readPropertiesFile( File file ) throws IOException {

		Properties result = new Properties();
		InputStream in = null;
		try {
			in = new FileInputStream( file );
			result.load( in );

		} finally {
			closeQuietly( in );
		}

		return result;
	}
1203441
public static Properties loadFile(File file) throws IOException {
		InputStream input = new FileInputStream(file);
		Properties prop = null;
		try {
			prop = load(input);
		} finally {
			IOUtils.close(input);
		}
		return prop;
	}
546265
final void compress(final File backupFile,
      final AppenderRollingProperties properties) {
    if (this.isCompressed(backupFile)) {
      LogLog.debug("Backup log file " + backupFile.getName()
          + " is already compressed");
      return; // try not to do unnecessary work
    }
    final long lastModified = backupFile.lastModified();
    if (0L == lastModified) {
      LogLog.debug("Backup log file " + backupFile.getName()
          + " may have been scavenged");
      return; // backup file may have been scavenged
    }
    final File deflatedFile = this.createDeflatedFile(backupFile);
    if (deflatedFile == null) {
      LogLog.debug("Backup log file " + backupFile.getName()
          + " may have been scavenged");
      return; // an error occurred creating the file
    }
    if (this.compress(backupFile, deflatedFile, properties)) {
      deflatedFile.setLastModified(lastModified);
      FileHelper.getInstance().deleteExisting(backupFile);
      LogLog.debug("Compressed backup log file to " + deflatedFile.getName());
    } else {
      FileHelper.getInstance().deleteExisting(deflatedFile); // clean up
      LogLog
          .debug("Unable to compress backup log file " + backupFile.getName());
    }
  }
871702
@SuppressWarnings("resource")
	public static ISynchronizationPoint<IOException> savePropertiesFile(
		Properties properties, IO.Writable output, Charset charset, byte priority, boolean closeIOAtEnd
	) {
		BufferedWritableCharacterStream stream = new BufferedWritableCharacterStream(output, charset, 4096);
		return savePropertiesFile(properties, stream, priority, closeIOAtEnd);
	}
798858
public void writePropertiesToFile(File outputFile) throws MojoExecutionException {// NOSONAR
        stripOutReservedProperties();
        //TODO if jmeter.properties write properties that are required for plugin
        if (properties.isEmpty()) {
            return;
        }
        try {
            try (FileOutputStream writeOutFinalPropertiesFile = new FileOutputStream(outputFile)) {
                properties.store(writeOutFinalPropertiesFile, null);
                writeOutFinalPropertiesFile.flush();
            }
        } catch (IOException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
1240948
public void saveTxt(String file) throws Exception {
		FileOutputStream fos = new FileOutputStream(file);
		BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(
				fos, "UTF8"));
		bout.write(this.toString());
		bout.close();

	}
493560
public void changedProps(final String filePath, final Map props) {
        history.push(new Action() {
            public ReturnCode execute() {
                final File file = new File(filePath);
                final Properties propsObj = new Properties();
                InputStream is = null;
                OutputStream os = null;
                try {
                    is = new FileInputStream(file);
                    propsObj.load(is);

                    // Restore old property values.
                    Iterator entries = props.entrySet().iterator();
                    while (entries.hasNext()) {
                        Map.Entry entry = (Map.Entry) entries.next();
                        String key = (String) entry.getKey();
                        String value = ((String[]) entry.getValue())[0];
                        propsObj.setProperty(key, value);
                    }

                    os = new FileOutputStream(file);
                    propsObj.store(os, null);
                    return ReturnCode.OK;
                } catch (IOException ioe) {
                    return new ReturnCode(ReturnCode.BAD_INPUT);
                } finally {
                    SelfExtractUtils.tryToClose(is);
                    SelfExtractUtils.tryToClose(os);
                }
            }
        });
    }
863657
public static void save(final File file, final Dependencies dependencies) {
        Utils4J.checkNotNull("file", file);
        Utils4J.checkValidFile(file);
        final XStream xstream = createXStream();
        try {
            final Writer writer = new FileWriter(file);
            try {
                xstream.toXML(dependencies, writer);
            } finally {
                writer.close();
            }
        } catch (final IOException ex) {
            throw new RuntimeException(ex);
        }
    }
24724
public void saveFile(File file, String type)
   {
      if (file != null)
      {
         m_treeController.saveFile(file, type);
      }
   }
860701
public static ParameterTool fromPropertiesFile(File file) throws IOException {
		if (!file.exists()) {
			throw new FileNotFoundException("Properties file " + file.getAbsolutePath() + " does not exist");
		}
		try (FileInputStream fis = new FileInputStream(file)) {
			return fromPropertiesFile(fis);
		}
	}
342521
private void loadProperties(File propFile) {
		if (propFile == null) {
			return;
		}
		try {
			loadProperties(new FileInputStream(propFile), propFile.getAbsolutePath());
		}
		catch (FileNotFoundException e) {
			Console.warn("Unable to find properties file ["+propFile.getAbsolutePath()+"].");
		}
	}
95447
public static void writePropertiesFile( Properties properties, File file ) throws IOException {

		OutputStream out = null;
		try {
			out = new FileOutputStream( file );
			properties.store( out, "" );

		} finally {
			closeQuietly( out );
		}
	}
347922
public void setProperties(Properties properties) {
		baseDir = properties.getProperty("base_dir", baseDir);
		inputFileLocation = baseDir + '/' + properties.getProperty("input_file_location", inputFileLocation);
		outputFileLocation = baseDir + '/' + properties.getProperty("output_file_location", outputFileLocation);
		tempOutputFileLocation = baseDir + '/' + properties.getProperty("temp_output_file_location", tempOutputFileLocation);
	}