本文整理汇总了Java中org.apache.commons.configuration.PropertiesConfiguration.copy方法的典型用法代码示例。如果您正苦于以下问题:Java PropertiesConfiguration.copy方法的具体用法?Java PropertiesConfiguration.copy怎么用?Java PropertiesConfiguration.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.configuration.PropertiesConfiguration
的用法示例。
在下文中一共展示了PropertiesConfiguration.copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: currentConfig
import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
@Override
public synchronized String currentConfig() {
PropertiesConfiguration saver = new PropertiesConfiguration();
StringWriter writer = new StringWriter();
saver.copy(config);
try { saver.save(writer); }
catch (Exception e) {
throw new MetricsConfigException("Error stringify config", e);
}
return writer.toString();
}
示例2: toString
import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
static String toString(Configuration c) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try {
PrintStream ps = new PrintStream(buffer, false, "UTF-8");
PropertiesConfiguration tmp = new PropertiesConfiguration();
tmp.copy(c);
tmp.save(ps);
return buffer.toString("UTF-8");
} catch (Exception e) {
throw new MetricsConfigException(e);
}
}
示例3: dump
import org.apache.commons.configuration.PropertiesConfiguration; //导入方法依赖的package包/类
static void dump(String header, Configuration c, PrintStream out) {
PropertiesConfiguration p = new PropertiesConfiguration();
p.copy(c);
if (header != null) {
out.println(header);
}
try { p.save(out); }
catch (Exception e) {
throw new RuntimeException("Error saving config", e);
}
}