Package java.util

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


                .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

                .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

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

            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

    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

       
        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

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

    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

    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

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.