Examples of loadFromXML()


Examples of java.util.Properties.loadFromXML()

    public static Properties readProperties(byte b[]) {
        Properties prop = new Properties();
        try {
            if (b != null) {
                prop.loadFromXML(new ByteArrayInputStream(b));
            }
        } catch (IOException e) {
        }
        return prop;
    }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

       
        Properties p = new Properties();
        try {
            byte[] img = getResourceAsBinary(sName);
            if (img != null) {
                p.loadFromXML(new ByteArrayInputStream(img));
            }
        } catch (IOException e) {
        }
        return p;
    }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

     * @throws ClassNotFoundException
     */
  private void initializeCoreElements() throws IOException,
    ClassNotFoundException {
    Properties p = new Properties();
    p.loadFromXML(Resource.getInstance().getStreamFromResourceLocation(
      "org/sbml/jsbml/resources/cfg/SBMLElementsLevel1Version1.xml"));
    for (Object k : p.keySet()) {
      String key = k.toString();
      SBMLCoreElements.put(key, Class.forName(p.getProperty(key).toString()));
    }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

    Type type = null;
    Properties stringToType = new Properties();
    String path = "cfg/ASTNodeTokens.xml";
    try
    {
      stringToType.loadFromXML(Resource.class.getResourceAsStream(path));
    }
    catch (InvalidPropertiesFormatException e)
    {
      throw new RuntimeException("Invalid configuration file entries in file " + Resource.class.getResource(path), e);
    }
View Full Code Here

Examples of java.util.Properties.loadFromXML()

    public static <T> void loadClasses(String path,
        Map<String, Class<? extends T>> whereToPutProperties) {
      Logger logger = Logger.getLogger(JSBML.class);
      Properties p = new Properties();
      try {
        p.loadFromXML(Resource.getInstance().getStreamFromResourceLocation(path));
        for (Map.Entry<Object, Object> entry : p.entrySet()) {
          try {
            whereToPutProperties.put(entry.getKey().toString(),
                (Class<T>) Class.forName(entry.getValue().toString()));
          } catch (ClassNotFoundException e) {
View Full Code Here

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

Examples of java.util.Properties.loadFromXML()

     * @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

Examples of java.util.Properties.loadFromXML()

        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

Examples of java.util.Properties.loadFromXML()

        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

Examples of java.util.Properties.loadFromXML()

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