Java.util.Properties.loadFromXML(InputStream in) Method Example
JAVA.UTIL.PROPERTIES.LOADFROMXML METHOD
Copyright ?
Description
The java.util.Properties.loadFromXMLInputStreamin method loads all of the properties represented by the XML document on the specified input stream into this properties table.
Declaration
Following is the declaration for java.util.Properties.loadFromXML method
public void loadFromXML(InputStream in)
Parameters
in -- the input stream from which to read the XML document.
Return Value
This method does not return a value.
Exception
IOException -- if reading from the specified input stream results in an IOException.
InvalidPropertiesFormatException -- Data on input stream does not constitute a valid XML document with the mandated document type.
NullPointerException -- if in is null.
Example
The following example shows the usage of java.util.Properties.loadFromXML method.
package com.tutorialspoint;
import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.*;
public class PropertiesDemo {
public static void main(String[] args) { Properties prop = new Properties();
// add some properties prop.put("Height", "200"); prop.put("Width", "15");
try {
// create a output and input as a xml file FileOutputStream fos = new FileOutputStream("properties.xml"); FileInputStream fis = new FileInputStream("properties.xml");
// store the properties in the specific xml prop.storeToXML(fos, null);
// load from the xml that we saved earlier prop.loadFrom XML(fis);
// print the properties list
prop.list(System .out);
} catch (IOException ex) { ex.printStackTrace(); }
} }
Let us compile and run the above program, this will produce the following result:
-- listing properties -Width=15 Height=200
Loading [MathJax]/jax/output/HTML-CSS/jax.js
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- java files copyright © tutorialspoint
- exploring java i o unit 4 exploring java i o
- serial communication in java with example program idc online
- java s input output github pages
- long n method example tutorialspoint
- intermediate programming adelphi university
- java files and i o
- input output classes java and oop
- chapter 20 streams and binary input output
- binary i o university of california san diego
Related searches
- houses properties for sale in hazleton
- inputstream and outputstream in java
- java copy inputstream to file
- java write inputstream to file
- string to java util date
- java get calling method name
- java reflection get method name
- in effect or in effect example sentences
- java main method string args
- boolean method example java
- elimination method example problems
- empirical method example psychology