Package java.util

Examples of java.util.Properties.loadFromXML()


            URL url = urls.nextElement();
            // TODO: May need a log here, instead of the system.out
            InputStream is = null;
            try {
                is = url.openStream();
                properties.loadFromXML(new BufferedInputStream(is));
            } finally {
                if (is != null) {
                    is.close();
                }
            }
View Full Code Here


     * @tests java.util.Properties#loadFromXML(java.io.InputStream)
     */
    public void test_loadFromXMLLjava_io_InputStream() throws Exception {
        InputStream is = new ByteArrayInputStream(writePropertiesXML("UTF-8"));
        Properties prop = new Properties();
        prop.loadFromXML(is);
        is.close();

        assertEquals("Failed to load correct properties", "value3", prop
                .getProperty("key3"));
        assertEquals("Failed to load correct properties", "value1", prop
View Full Code Here

        assertEquals("Failed to load correct properties", "value1", prop
                .getProperty("key1"));

        is = new ByteArrayInputStream(writePropertiesXML("ISO-8859-1"));
        prop = new Properties();
        prop.loadFromXML(is = new ByteArrayInputStream(
                writePropertiesXML("ISO-8859-1")));
        is.close();
        assertEquals("Failed to load correct properties", "value2", prop
                .getProperty("key2"));
        assertEquals("Failed to load correct properties", "value1", prop
View Full Code Here

        myProps.storeToXML(out, "comment");
        out.close();

        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
        Properties myProps2 = new Properties();
        myProps2.loadFromXML(in);
        in.close();

        Enumeration e = myProps.propertyNames();
        String nextKey;
        while (e.hasMoreElements()) {
View Full Code Here

        myProps.storeToXML(out, "comment", "ISO-8859-1");
        out.close();

        in = new ByteArrayInputStream(out.toByteArray());
        myProps2 = new Properties();
        myProps2.loadFromXML(in);
        in.close();

        e = myProps.propertyNames();
        while (e.hasMoreElements()) {
            nextKey = (String) e.nextElement();
View Full Code Here


    Properties temp = new Properties();
    try {
      if (xml) {
        temp.loadFromXML(stream);
        if (LOG.isDebugEnabled()) {
          LOG.debug(childPath);
          LOG.debug("xml properties: {}", temp.size());
        }
      } else {
View Full Code Here

        if (fis == null) {
          throw new IOException("Was unable to open " + configFile);
        }

        // load the configuration file as properties
        customFieldProps.loadFromXML(fis);

        // loop through the properties setting field flags
        Enumeration propKeys = customFieldProps.keys();
        while (propKeys.hasMoreElements()) {
          String prop = (String)propKeys.nextElement();
View Full Code Here

      InputStream fis = CustomFields.class.getClassLoader().getResourceAsStream(
        configFile);
      if (fis == null) {
        throw new IOException("Was unable to open " + configFile);
      }
      customFieldProps.loadFromXML(fis);
      Enumeration keys = customFieldProps.keys();
      while (keys.hasMoreElements()) {
        String prop = (String)keys.nextElement();
        if (prop.endsWith(".name")) {
          String propName = prop.substring(0, prop.length() - 5);
View Full Code Here

        props = new Properties();
        Util.p("===");
        for(Entry e : props.entrySet()) {
            Util.p("key = " + e.getKey() + " " + e.getValue() );
        }
        props.loadFromXML(new FileInputStream("foo.xml"));
        Util.p("===");
        for(Entry e : props.entrySet()) {
            Util.p("key = " + e.getKey() + " " + e.getValue() );
        }
    }
View Full Code Here

    }

    private void loadSettings() {
        try {
            Properties props = new Properties();
            props.loadFromXML(new FileInputStream("settings.xml"));
            Util.p("Loaded settings: " + props.keySet().size());

            recentUniqueSketches.clear();
            if(props.containsKey(RECENT_SKETCHES)) {
                String[] s = props.getProperty(RECENT_SKETCHES).split(",");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.