code.dreamsense.com

May 19, 2020

Last time we talked about reading prooperty files. Today let's store the property information xml format.

We'll take the previous example and make one change to it. Instead of calling store, we'll call storeToXML.

    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Properties;

    public class Property {

      public static void main(String[] args)
        throws FileNotFoundException, IOException {
        Properties props = new Properties();
        props.put("one", "1");
        props.put("two", "2");
        props.storeToXML(new FileOutputStream("test.properties"),
          "any comment here");
      }

    }
  

Kyle Eggleston
kyle@dreamsense.com
Copyright © 2003 - 2020 archive