Package java.util

Examples of java.util.Properties.loadFromXML()


     * @throws IOException
     */
    public XMLResourceBundle(InputStream stream) throws IOException,
      InvalidPropertiesFormatException {
      Properties defaults = new Properties();
      defaults.loadFromXML(stream);
      properties = new Properties(defaults);
    }
   
    /* (non-Javadoc)
     * @see java.util.ResourceBundle#getKeys()
View Full Code Here


     * @tests java.util.Properties#loadFromXML(java.io.InputStream)
     */
    public void test_loadFromXMLLjava_io_InputStream() throws IOException {
        Properties prop = new Properties();
        InputStream is = new ByteArrayInputStream(writePropertiesXML("UTF-8"));
        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"));

        prop = new Properties();
        is = new ByteArrayInputStream(writePropertiesXML("ISO-8859-1"));
        prop.loadFromXML(is);
        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();
        while (e.hasMoreElements()) {
            String nextKey = (String) e.nextElement();
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()) {
            String nextKey = (String) e.nextElement();
View Full Code Here

    }

    public void loadProperties(InputStream in, String systemId)
            throws IOException {
        Properties props = new Properties();
        props.loadFromXML(in);
        setProperties(props);
        log.debug("Loaded properties from {}.", systemId);
    }

    public void loadPrivileges(InputStream in, String systemId)
View Full Code Here

    protected void loadProperties(File metaDir) throws IOException {
        File file = new File(metaDir, Constants.PROPERTIES_XML);
        if (file.isFile()) {
            Properties properties = new Properties();
            properties.loadFromXML(FileUtils.openInputStream(file));
            this.properties = properties;
        }
    }

    protected void saveProperties(File metaDir) throws IOException {
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

    }
    Properties prop = new Properties();
    BufferedInputStream bis = null;
    try {
      bis = new BufferedInputStream(is);
      prop.loadFromXML(bis);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      IOUtils.closeQuietly(bis);
    }
View Full Code Here

        // 2. Create views
        LOG.debug("Creating views");
        try {
            InputStream viewsStream = getClass().getResourceAsStream("/views.xml");
            Properties views = new Properties();
            views.loadFromXML(viewsStream);

            for (String idx : views.stringPropertyNames()) {
                LOG.debug("Creating view {}", views.get(idx).toString());

                try {
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.