List of usage examples for java.util Properties store
public void store(OutputStream out, String comments) throws IOException
From source file:com.benasmussen.maven.plugin.i18n.io.PropertiesResourceWriter.java
@Override protected void after(ResourceEntry resourceEntry) { super.after(resourceEntry); Set<String> keySet = output.keySet(); for (String locale : keySet) { String filename = getFilename(resourceEntry, locale); Writer writer = null;//from ww w .j a v a2 s .c om try { File outputFile = new File(outputFolder, filename); writer = new OutputStreamWriter(new FileOutputStream(outputFile), getOutputEnconding()); Properties properties = output.get(locale); properties.store(writer, "Generated file " + filename); } catch (Exception e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(writer); } } }
From source file:com.bigdata.rdf.properties.text.PropertiesTextWriter.java
@Override public void write(final Properties properties) throws IOException { properties.store(os, null/*comment*/); }
From source file:io.fluo.cluster.main.MainOptions.java
public void validateConfig() throws IOException { if (getConfigDir() == null) { System.err.println(/*from w w w . j a v a2 s. c om*/ "Please set -config-dir option to directory containing fluo.properties file like below: "); System.err.println(); Properties defaults = ConfigurationConverter.getProperties(FluoConfiguration.getDefaultConfiguration()); defaults.store(System.err, "Fluo properties"); System.exit(-1); } }
From source file:de.avanux.livetracker.mobile.LocationReceiver.java
/** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) *//*from ww w.ja va 2 s . c o m*/ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String trackingID = request.getParameter(LocationMessage.TRACKING_ID); String lat = request.getParameter(LocationMessage.LAT); String lon = request.getParameter(LocationMessage.LON); String time = request.getParameter(LocationMessage.TIME); String speed = request.getParameter(LocationMessage.SPEED); if ((trackingID != null) && (lat != null) && (lon != null) && (time != null) && (speed != null)) { PrintWriter out = null; try { LocationMessage locationMessage = new LocationMessage(Integer.parseInt(trackingID), new DateTime(Long.parseLong(time)), Float.parseFloat(lat), Float.parseFloat(lon), Float.parseFloat(speed)); log.debug(locationMessage.getTrackingID() + " Location message received: " + locationMessage); Tracking tracking = TrackingManager.getTracking(locationMessage.getTrackingID()); tracking.setLocationMessage(locationMessage); out = response.getWriter(); Properties configuration = buildResponse(tracking); configuration.store(out, null); } catch (Exception e) { log.error("Error receiving location message:", e); } finally { if (out != null) { out.close(); } } } else { log.error("Incomplete location message ignored."); } }
From source file:com.websqrd.catbot.setting.CatbotSettings.java
private static void storeProperties(Properties props, String filename) { String configFile = getKey(filename); FileOutputStream writer = null; try {// w w w .j a v a 2 s.com writer = new FileOutputStream(configFile); props.store(writer, null); putToCache(props, filename); } catch (IOException e) { logger.error(e.getMessage(), e); } finally { try { writer.close(); } catch (IOException e) { //ignore } } }
From source file:fr.msch.wissl.server.Library.java
private static void stfuLog4j() { Properties props = new Properties(); // props.setProperty("org.jaudiotagger.level", // Level.WARNING.toString()); props.setProperty(".level", Level.OFF.toString()); // props.setProperty("handlers", // "java.util.logging.ConsoleHandler,java.util.logging.FileHandler"); try {/*from w w w .j a v a 2 s. c om*/ ByteArrayOutputStream baos = new ByteArrayOutputStream(); props.store(baos, null); byte[] data = baos.toByteArray(); baos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(data); LogManager.getLogManager().readConfiguration(bais); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.github.marabou.properties.PropertiesLoader.java
private void writeUserProperties(Properties userProperties) throws IOException { BufferedWriter userConf = createWriter(pathHelper.getUserPropertiesFilePath()); userProperties.store(userConf, null); userConf.flush();//from w w w .j a v a 2 s . c om userConf.close(); }
From source file:io.github.jrobotframework.syntax.HighlighterUtils.java
public String highlightProperties(Properties properties, String comment) { try {/*from w w w.jav a 2 s .c om*/ StringWriter writer = new StringWriter(); properties.store(writer, comment); return highlight(writer.toString(), "properties"); } catch (IOException e) { return properties.toString(); } }
From source file:com.bekwam.examples.javafx.oldscores.SettingsDAOImpl.java
@Override public void save() throws IOException { if (logger.isDebugEnabled()) { logger.debug("[SAVE] saving " + getAbsolutePath()); }//from ww w. j a v a 2s .c om FileWriter fw = new FileWriter(getAbsolutePath()); Properties props = new Properties(); props.setProperty("oldscores.roundUp", String.valueOf(settings.getRoundUp())); props.store(fw, ""); fw.close(); }
From source file:com.citruspay.mobile.payment.oauth2.PropertiesFileTokenStore.java
protected void storeAsProperties(Properties tokens) { OutputStream os = null;/*www.ja va2 s. c o m*/ try { os = new FileOutputStream(store); tokens.store(os, ""); } catch (IOException iox) { throw new RuntimeException(iox); } finally { if (os != null) { try { os.close(); } catch (IOException x) { /* ignore */} } } }