List of usage examples for org.apache.commons.configuration PropertiesConfiguration save
public void save(OutputStream out, String encoding) throws ConfigurationException
From source file:com.github.zdsiyan.maven.plugin.smartconfig.internal.PropertyConfigurator.java
@Override public ByteArrayOutputStream execute(InputStream in, Charset charset, List<PointHandle> pointhandles) throws IOException { try {/* ww w . j a v a 2s . co m*/ PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.load(in, charset.name()); pointhandles.forEach(point -> { switch (point.getMode()) { case insert: configuration.addProperty(point.getExpression(), point.getValue()); break; case delete: configuration.setProperty(point.getExpression(), ""); break; case replace: default: configuration.setProperty(point.getExpression(), point.getValue()); break; } }); // output ByteArrayOutputStream out = new ByteArrayOutputStream(); configuration.save(out, charset.name()); return out; } catch (ConfigurationException ex) { // FIXME throw new RuntimeException(ex); } }