Java Code Examples for java.util.Properties#storeToXML()
The following examples show how to use
java.util.Properties#storeToXML() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: CameraV File: DropboxSyncManager.java License: GNU General Public License v3.0 | 6 votes |
private void saveCredentials () throws IOException { if (mSession != null && mSession.isLinked() && mSession.getOAuth2AccessToken() != null) { mStoredAccessToken = mSession.getOAuth2AccessToken(); Properties props = new Properties(); props.setProperty("dbtoken", mStoredAccessToken); info.guardianproject.iocipher.File fileProps = new info.guardianproject.iocipher.File("/dropbox.properties"); info.guardianproject.iocipher.FileOutputStream fos = new info.guardianproject.iocipher.FileOutputStream(fileProps); props.storeToXML(fos,""); fos.close(); } else { Log.d("Dropbox","no valid dropbox session / not linked"); } }
Example 2
Source Project: maven-framework-project File: Properties2XML.java License: MIT License | 5 votes |
/** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { Properties props = new Properties(); props.setProperty("email.support", "[email protected]"); props.setProperty("email.password", "*********"); props.setProperty("email.host", "smtp.163.com"); props.setProperty("email.port", "25"); OutputStream os = new FileOutputStream("target/email-config.xml"); props.storeToXML(os, "email config","UTF-8"); System.out.println("Done"); }
Example 3
Source Project: visualvm File: ProfilerStorageProvider.java License: GNU General Public License v2.0 | 5 votes |
protected void saveProperties(Properties properties, FileObject storage) throws IOException { synchronized (this) { OutputStream os = storage.getOutputStream(); BufferedOutputStream bos = new BufferedOutputStream(os); try { properties.storeToXML(bos, ""); // NOI18N } finally { if (bos != null) bos.close(); } } }
Example 4
Source Project: jackrabbit-filevault File: TestPackageInstall.java License: Apache License 2.0 | 5 votes |
/** * Tests if installing a package with a 0-mtime entry works with java9. * see http://bugs.java.com/view_bug.do?bug_id=JDK-8184940 */ @Test public void testPackageInstallWith0MtimeZipEntry() throws IOException, RepositoryException, NoSuchFieldException, IllegalAccessException { ByteArrayOutputStream out = new ByteArrayOutputStream(); ZipOutputStream zout = new ZipOutputStream(out); Properties p = new Properties(); p.setProperty("name", TMP_PACKAGE_ID.getName()); p.setProperty("group", TMP_PACKAGE_ID.getGroup()); p.setProperty("version", TMP_PACKAGE_ID.getVersionString()); ZipEntry e = new ZipEntry("META-INF/vault/properties.xml"); Field field = ZipEntry.class.getDeclaredField("xdostime"); field.setAccessible(true); field.setLong(e, 0); zout.putNextEntry(e); p.storeToXML(zout, "", "utf-8"); zout.closeEntry(); zout.putNextEntry(new ZipEntry("jcr_root/")); zout.closeEntry(); zout.close(); out.close(); JcrPackage pack = packMgr.upload(new ByteArrayInputStream(out.toByteArray()), true); assertEquals("packageid", TMP_PACKAGE_ID, pack.getDefinition().getId()); }
Example 5
Source Project: AndroidDesignPreview File: ControllerForm.java License: Apache License 2.0 | 5 votes |
private void trySaveFrameConfig() { try { Properties props = new Properties(); props.setProperty("x", String.valueOf(frame.getX())); props.setProperty("y", String.valueOf(frame.getY())); props.storeToXML(new FileOutputStream( new File(Util.getCacheDirectory(), "config.xml")), null); } catch (IOException e) { e.printStackTrace(); } }
Example 6
Source Project: journaldev File: PropertyFilesUtil.java License: MIT License | 5 votes |
/** * This method writes Property files into file system in property file * and xml format * @param fileName * @throws IOException */ private static void writePropertyFile(String propertyFileName, String xmlFileName) throws IOException { System.out.println("Start of writePropertyFile"); Properties prop = new Properties(); prop.setProperty("db.host", "localhost"); prop.setProperty("db.user", "user"); prop.setProperty("db.pwd", "password"); prop.store(new FileWriter(propertyFileName), "DB Config file"); System.out.println(propertyFileName + " written successfully"); prop.storeToXML(new FileOutputStream(xmlFileName), "DB Config XML file"); System.out.println(xmlFileName + " written successfully"); System.out.println("End of writePropertyFile"); }
Example 7
Source Project: development File: BillingAdapterAssembler.java License: Apache License 2.0 | 5 votes |
static String convertPropertiesToXML(Properties properties) throws IOException { if (properties != null) { String xmlString; try (OutputStream out = new ByteArrayOutputStream()) { properties.storeToXML(out, null, "UTF-8"); xmlString = out.toString(); } return xmlString; } return null; }
Example 8
Source Project: ramus File: RolesView.java License: GNU General Public License v3.0 | 5 votes |
public void setProperty(final String key, final String value) { Properties properties = getProperties(); properties.setProperty(key, value); final OutputStream out = setNamedData(PROPERTIES); try { properties.storeToXML(out, ""); out.close(); } catch (final IOException e) { e.printStackTrace(); } }
Example 9
Source Project: open-ig File: Configuration.java License: GNU Lesser General Public License v3.0 | 5 votes |
/** * Save the configuration. * @return true if the save was successful. */ public boolean save() { try { Properties props = new Properties(); try (FileOutputStream fout = new FileOutputStream(fileName)) { saveProperties(props); props.storeToXML(fout, "Open Imperium Galactica Configuration"); } isNew = false; return true; } catch (IOException ex) { Exceptions.add(ex); return false; } }
Example 10
Source Project: Ngram-Graphs File: AutoSummENGGui.java License: Apache License 2.0 | 5 votes |
/** Save GUI settings in file. */ private void saveSettings() { Properties pOut = new Properties(); // Dirs pOut.setProperty("ModelDir", ModelsRootDirEdt.getText()); pOut.setProperty("SummaryDir", SummariesRootDirEdt.getText()); pOut.setProperty("OutputFile", OutputFileEdt.getText()); // Global settings pOut.setProperty("Threads", ThreadCntEdt.getValue().toString()); pOut.setProperty("Silent", String.valueOf(SilentChk.isSelected())); pOut.setProperty("ShowProgress", String.valueOf(ProgressChk.isSelected())); pOut.setProperty("DoWord", String.valueOf(DoWordChk.isSelected())); pOut.setProperty("DoChar", String.valueOf(DoCharChk.isSelected())); pOut.setProperty("Use", OccurencesChk.isSelected() ? "Occurences" : "Distros"); // Char settings pOut.setProperty("CharMin", String.valueOf(CharMinEdt.getValue())); pOut.setProperty("CharMax", String.valueOf(CharMaxEdt.getValue())); pOut.setProperty("CharDist", String.valueOf(CharDistEdt.getValue())); // Word settings pOut.setProperty("WordMin", String.valueOf(WordMinEdt.getValue())); pOut.setProperty("WordMax", String.valueOf(WordMaxEdt.getValue())); pOut.setProperty("WordDist", String.valueOf(WordDistEdt.getValue())); // Save try { FileOutputStream fsOut = new FileOutputStream("AutoSummENGGUI.properties"); pOut.storeToXML(fsOut, ""); fsOut.flush(); fsOut.close(); } catch (IOException ioe) { ioe.printStackTrace(System.err); } }
Example 11
Source Project: spring-analysis-note File: DefaultPropertiesPersister.java License: MIT License | 4 votes |
@Override public void storeToXml(Properties props, OutputStream os, String header) throws IOException { props.storeToXML(os, header); }
Example 12
Source Project: spring-analysis-note File: DefaultPropertiesPersister.java License: MIT License | 4 votes |
@Override public void storeToXml(Properties props, OutputStream os, String header, String encoding) throws IOException { props.storeToXML(os, header, encoding); }
Example 13
Source Project: jdk8u_jdk File: LoadAndStoreXMLWithDefaults.java License: GNU General Public License v2.0 | 4 votes |
@Override public String writeToXML(Properties p) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); p.storeToXML(baos, "Test 8016344"); return baos.toString(); }
Example 14
Source Project: java-technology-stack File: DefaultPropertiesPersister.java License: MIT License | 4 votes |
@Override public void storeToXml(Properties props, OutputStream os, String header, String encoding) throws IOException { props.storeToXML(os, header, encoding); }
Example 15
Source Project: spring4-understanding File: DefaultPropertiesPersister.java License: Apache License 2.0 | 4 votes |
@Override public void storeToXml(Properties props, OutputStream os, String header, String encoding) throws IOException { props.storeToXML(os, header, encoding); }
Example 16
Source Project: jdk8u-dev-jdk File: LoadAndStoreXMLWithDefaults.java License: GNU General Public License v2.0 | 4 votes |
@Override public String writeToXML(Properties p) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); p.storeToXML(baos, "Test 8016344"); return baos.toString(); }
Example 17
Source Project: openjdk-8-source File: LoadAndStoreXMLWithDefaults.java License: GNU General Public License v2.0 | 4 votes |
@Override public String writeToXML(Properties p) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); p.storeToXML(baos, "Test 8016344"); return baos.toString(); }
Example 18
Source Project: openjdk-jdk9 File: LoadAndStoreXMLWithDefaults.java License: GNU General Public License v2.0 | 4 votes |
static String writeToXML(Properties props) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); props.storeToXML(baos, "Test 8016344"); return baos.toString(); }
Example 19
Source Project: jdk8u-jdk File: LoadAndStoreXMLWithDefaults.java License: GNU General Public License v2.0 | 4 votes |
@Override public String writeToXML(Properties p) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); p.storeToXML(baos, "Test 8016344"); return baos.toString(); }
Example 20
Source Project: openjdk-8 File: LoadAndStoreXMLWithDefaults.java License: GNU General Public License v2.0 | 4 votes |
@Override public String writeToXML(Properties p) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); p.storeToXML(baos, "Test 8016344"); return baos.toString(); }