Example usage for java.util Properties store

List of usage examples for java.util Properties store

Introduction

In this page you can find the example usage for java.util Properties store.

Prototype

public void store(OutputStream out, String comments) throws IOException 

Source Link

Document

Writes this property list (key and element pairs) in this Properties table to the output stream in a format suitable for loading into a Properties table using the #load(InputStream) load(InputStream) method.

Usage

From source file:com.bekwam.examples.javafx.oldscores2.data.SettingsDAOImpl.java

@Override
public void save() throws IOException {

    if (logger.isDebugEnabled()) {
        logger.debug("[SAVE] saving " + getAbsolutePath());
    }/*from   w  w  w . j ava2  s  . co m*/
    FileWriter fw = new FileWriter(getAbsolutePath());
    Properties props = new Properties();
    props.setProperty("oldscores.roundUp", String.valueOf(settings.getRoundUp()));
    props.store(fw, "");
    fw.close();

    markForRefresh();
}

From source file:org.opencastproject.remotetest.capture.CaptureRestEndpointTest.java

@Before
public void setUp() throws Exception {
    httpClient = Main.getClient();/*from w ww  .  j av  a2 s.  com*/
    String time = String.valueOf(System.currentTimeMillis());

    // Test Properties from resources
    Properties props = new Properties();
    props.put("capture.recording.id", time);

    StringWriter writer = new StringWriter();
    props.store(writer, null);
    startParams.add(new BasicNameValuePair("config", writer.toString()));

    stopParams = new ArrayList<NameValuePair>();
    stopParams.add(new BasicNameValuePair("recordingID", time));

}

From source file:nl.flotsam.greader.http.PropertiesHttpMessageConverter.java

@Override
protected void writeInternal(Properties properties, HttpOutputMessage outputMessage)
        throws IOException, HttpMessageNotWritableException {
    OutputStream out = null;//  w w w.  ja  v a 2 s.  c om
    try {
        out = outputMessage.getBody();
        properties.store(out, "");
    } finally {
        IOUtils.closeQuietly(out);
    }
}

From source file:com.anjlab.sat3.Program.java

private static void writeSatToFile(ITabularFormula formula, String resultsFile, Properties statistics,
        ObjectArrayList route) throws IOException {
    OutputStream out = null;//from w  ww .  j av  a  2  s  . co m
    try {
        out = new FileOutputStream(new File(resultsFile));

        IVertex vertex = null;
        for (int i = 0; i < route.size(); i++) {
            vertex = (IVertex) route.get(i);

            writeToStatistics(formula, statistics, vertex.getPermutation().getAName(),
                    vertex.getTripletValue().isNotA());
        }
        if (vertex != null) {
            writeToStatistics(formula, statistics, vertex.getPermutation().getBName(),
                    vertex.getTripletValue().isNotB());
            writeToStatistics(formula, statistics, vertex.getPermutation().getCName(),
                    vertex.getTripletValue().isNotC());
        }

        statistics.store(out, "Satisfiable. Variable values from HSS route");
    } finally {
        if (out != null) {
            out.close();
        }
    }
}

From source file:org.atomserver.testutils.client.MockRequestContext.java

public void setPropertiesAsEntry(Properties props) throws IOException {
    Entry entry = context.getAbdera().getFactory().newEntry();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    props.store(out, null);
    entry.setContent(out.toString());/* ww  w .  jav a2 s .co m*/
    setContent(entry);
}

From source file:de.fhg.fokus.nubomedia.App.java

public void makeFile() {
    try {/*from w ww  .  j  a v a 2 s .c  o m*/
        String fileName = System.getProperty("user.home") + "/.kurento/config.properties";

        log.info("saving the property file here : " + fileName);

        java.util.Properties p = new java.util.Properties();
        p.setProperty("kms.url.provider", "de.fhg.fokus.nubomedia.kmc.KmsProvider");

        File file = new File(fileName);
        FileOutputStream fileOut = new FileOutputStream(file);
        p.store(fileOut, "config.properties");
        fileOut.close();

    } catch (FileNotFoundException e) {
        System.out.println("property file could not be found!");
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.opensource.frameworks.processframework.utils.DefaultPropertiesPersister.java

public void store(Properties props, OutputStream os, String header) throws IOException {
    props.store(os, header);
}

From source file:com.googlecode.t7mp.steps.CopyUserConfigStep.java

private void writePropertiesToFile(Properties properties, File target) throws IOException {
    OutputStream defaultOut = null;
    try {/*from   w  ww. j a  v  a  2  s .co  m*/
        defaultOut = new FileOutputStream(target);
        properties.store(defaultOut, "");
    } finally {
        IOUtils.closeQuietly(defaultOut);
    }
}

From source file:com.streamsets.datacollector.el.TestRuntimeEL.java

@Test
public void testRuntimeELExternal() throws IOException {
    File configDir = new File("target", UUID.randomUUID().toString()).getAbsoluteFile();
    Assert.assertTrue(configDir.mkdirs());
    try (OutputStream os = new FileOutputStream(new File(configDir, "sdc.properties"))) {
        Properties props = new Properties();
        props.setProperty("runtime.conf.location", "foo.properties");
        props.store(os, "");
    }//from   w ww  .  j  a v  a 2s  . co  m
    try (OutputStream os = new FileOutputStream(new File(configDir, "foo.properties"))) {
        Properties props = new Properties();
        props.setProperty("foo", "bar");
        props.store(os, "");
    }
    RuntimeInfo runtimeInfo = Mockito.mock(RuntimeInfo.class);
    Mockito.when(runtimeInfo.getConfigDir()).thenReturn(configDir.getAbsolutePath());
    RuntimeEL.loadRuntimeConfiguration(runtimeInfo);
    Assert.assertEquals("bar", RuntimeEL.conf("foo"));
}

From source file:net.sourceforge.atunes.kernel.modules.tags.PropertiesFileTagAdapter.java

private void setProperties(final ILocalAudioObject file, final Properties properties) {
    try {/*from   w w w . j  a v  a  2s  . c  o  m*/
        properties.store(new FileOutputStream(getPropertiesFile(file)), "Metadata generated with aTunes");
    } catch (FileNotFoundException e) {
        reportError(file, e);
    } catch (IOException e) {
        reportError(file, e);
    }
}