Properties: loadFromXML(InputStream in) : Properties « java.util « Java by API






Properties: loadFromXML(InputStream in)

 
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Date;
import java.util.Properties;

public class Main {
  public static void main(String args[]) throws Exception {
    Properties p = new Properties();

    p.put("today", new Date().toString());
    p.put("user", "A");

    FileOutputStream out = new FileOutputStream("user.props");
    p.storeToXML(out, "updated");

    FileInputStream in = new FileInputStream("user.props");

    p.loadFromXML(in);
    p.list(System.out);
  }
}

   
  








Related examples in the same category

1.new Properties()
2.new Properties(Properties prop)
3.Properties: getProperty(String key)
4.Properties: getProperty(String key, String defaultValue)
5.Properties: list(PrintStream out)
6.Properties: load(InputStream inStream)
7.Properties: keySet()
8.Properties: propertyNames()
9.Properties: setProperty(String key, String value)
10.Properties: store(OutputStream out, String comments)
11.Properties: storeToXML(OutputStream os, String comment)