Java 类org.apache.commons.configuration2.io.FileHandler 实例源码

项目:beadledom    文件:XmlConfigurationSource.java   
private static FileBasedConfiguration createConfiguration(Reader reader)
    throws ConfigurationException {
  if (reader == null) {
    throw new NullPointerException("reader: null");
  }

  FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
      new FileBasedConfigurationBuilder<FileBasedConfiguration>(XMLConfiguration.class)
          .configure(new Parameters().xml());

  FileBasedConfiguration fileBasedConfiguration = builder.getConfiguration();

  FileHandler handler = new FileHandler(fileBasedConfiguration);
  handler.load(reader);
  return fileBasedConfiguration;
}
项目:standalone-app    文件:Helios.java   
private static Configuration loadConfiguration() throws IOException, ConfigurationException {
    Configurations configurations = new Configurations();
    File file = Constants.SETTINGS_FILE_XML;
    if (!file.exists()) {
        XMLConfiguration tempConfiguration = new XMLConfiguration();
        new FileHandler(tempConfiguration).save(file);
    }
    FileBasedConfigurationBuilder<XMLConfiguration> builder = configurations.xmlBuilder(file);
    builder.setAutoSave(true);
    return builder.getConfiguration();
}
项目:standalone-app    文件:Helios.java   
private static Configuration loadConfiguration() throws IOException, ConfigurationException {
    Configurations configurations = new Configurations();
    File file = Constants.SETTINGS_FILE_XML;
    if (!file.exists()) {
        XMLConfiguration tempConfiguration = new XMLConfiguration();
        new FileHandler(tempConfiguration).save(file);
    }
    FileBasedConfigurationBuilder<XMLConfiguration> builder = configurations.xmlBuilder(file);
    builder.setAutoSave(true);
    return builder.getConfiguration();
}