Examples of loadFromXML()


Examples of java.util.Properties.loadFromXML()

                "]>" + element.toString();
        final Properties properties = new Properties();
        InputStream in = null;
        try {
            in = new ByteArrayInputStream(xml.getBytes());
            properties.loadFromXML(in);
            return properties;
        } catch (IOException e) {
            handleException("IOError loading properties from : " + element);
        } finally {
            if (in != null) {
View Full Code Here

Examples of java.util.Properties.loadFromXML()

    for(String f : files) {
      File file = FileHelper.getFile(f);
      InputStream input = new FileInputStream(file);
      try {
        if(file.getPath().endsWith(".xml")){
          properties.loadFromXML(input);
        }else {
          properties.load(input);
        }
        properties.putAll(properties);
      }finally {
View Full Code Here

Examples of java.util.Properties.loadFromXML()

  public Properties loadProperties(String file) {
    try {
      Properties p = new Properties();
      InputStream in = FileHelper.getInputStream(file);
      if(file.endsWith(".xml")) {
        p.loadFromXML(in);
      }else {
        p.load(in);
      }
      in.close();
      return p;
View Full Code Here

Examples of java.util.Properties.loadFromXML()

    protected void loadFile(File file) throws BuildException {
        if(file.getName().endsWith(".xml")) {
            try {
                Properties props = new Properties();
                FileInputStream in = new FileInputStream(file);
                props.loadFromXML(in);
                in.close();
                addProperties(props);
            }catch(IOException e) {
                throw new BuildException("load properties occer error:"+file+" cause:"+e,e);
            }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

                if (log.isDebugEnabled()) {
                    log.debug("Loading properties from path [" + resourcePath + "] in XML format...");
                }

                props.loadFromXML(is);
            } else {

                if (log.isDebugEnabled()) {
                    log.debug("Loading properties from path [" + resourcePath + "]...");
                }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

        // java.util.Properties.loadFromXML(java.io.InputStream)
        Properties prop = null;
        try {
            InputStream is;
            prop = new Properties();
            prop.loadFromXML(is = new ByteArrayInputStream(
                    writePropertiesXMLUTF_8()));
            is.close();
        } catch (Exception e) {
            fail("Exception during load test : " + e.getMessage());
        }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

                .getProperty("key1"));

        try {
            InputStream is;
            prop = new Properties();
            prop.loadFromXML(is = new ByteArrayInputStream(
                    writePropertiesXMLISO_8859_1()));
            is.close();
        } catch (Exception e) {
            fail("Exception during load test : " + e.getMessage());
        }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

                .getProperty("key2"));
        assertEquals("Failed to load correct properties", "value1", prop
                .getProperty("key1"));
       
        try {
            prop.loadFromXML(null);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
    }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

            // store in UTF-8 encoding
            myProps.storeToXML(out, "comment");
            out.close();
            ByteArrayInputStream in = new ByteArrayInputStream(out
                    .toByteArray());
            myProps2.loadFromXML(in);
            in.close();
        } catch (InvalidPropertiesFormatException ipfe) {
            fail("InvalidPropertiesFormatException occurred reading file: "
                    + ipfe.getMessage());
        } catch (IOException ioe) {
View Full Code Here

Examples of java.util.Properties.loadFromXML()

            myProps.storeToXML(out, "comment", "ISO-8859-1");
            out.close();
            ByteArrayInputStream in = new ByteArrayInputStream(out
                    .toByteArray());
            myProps2 = new Properties();
            myProps2.loadFromXML(in);
            in.close();
        } catch (InvalidPropertiesFormatException ipfe) {
            fail("InvalidPropertiesFormatException occurred reading file: "
                    + ipfe.getMessage());
        } catch (IOException ioe) {
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.