/** * Reads and returns the stored Properties, usually from a file. * @return {@link Properties} * @throws FileNotFoundException * @throws Exception * @throws IOException */ protected Properties readPropertiesFromStore() throws FileNotFoundException, IOException { Properties ret; // Todo: Which class loader to use? library service unavailable, because it depends on settings service? File file = getFile(filename); FileInputStream fis = new FileInputStream(file.exists() ? file : getFile("default"+SETTINGS_EXTENSION)); ret = (Properties)PropertiesXMLHelper.read(fis, getClass().getClassLoader()); fis.close(); return ret; }
public void resultAvailable(File file) { FileOutputStream os = null; try { os = new FileOutputStream(file); PropertiesXMLHelper.write(props, os, getClass().getClassLoader()); } catch(Exception e) { } finally { if(os!=null) { try { os.close(); } catch(Exception e) { } } } }
/** * Convert an xml to an object. * @param val The string value. * @return The decoded object. */ public static <T> T read(String val, ClassLoader classloader) { return (T)AReader.objectFromXML(XMLReaderFactory.getInstance().createReader(), val, classloader, getPathManager(), getObjectReaderHandler()); }
/** * Convert to a string. */ public static void write(Object val, OutputStream os, ClassLoader classloader) { AWriter.objectToOutputStream(XMLWriterFactory.getInstance().createWriter(), val, os, classloader, null, getObjectWriterHandler()); }
/** * Convert to a string. */ public static String write(Object val, ClassLoader classloader) { return AWriter.objectToXML(XMLWriterFactory.getInstance().createWriter(), val, classloader, getObjectWriterHandler()); }
protected void proceed(File file) { FileInputStream fis = null; try { fis = new FileInputStream(file); Properties props = (Properties)PropertiesXMLHelper.read(fis, getClass().getClassLoader()); ret.setResult(props); } catch(Exception e) { ret.setException(e); } finally { if(fis!=null) { try { fis.close(); } catch(Exception e) { } } } } });
/** * Writes the given properties into a Store, usually a file. * @throws FileNotFoundException * @throws Exception * @throws IOException */ protected void writePropertiesToStore(Properties props) throws FileNotFoundException, Exception, IOException { // Todo: Which class loader to use? library service unavailable, because // it depends on settings service? File file = getFile(filename); FileOutputStream os = new FileOutputStream(file); PropertiesXMLHelper.write(props, os, getClass().getClassLoader()); os.close(); }
/** * Convert an xml to an object. * @param val The string value. * @return The decoded object. */ public static <T> T read(InputStream is, ClassLoader classloader) { return (T)AReader.objectFromInputStream(XMLReaderFactory.getInstance().createReader(), is, classloader, getPathManager(), getObjectReaderHandler()); }
protected void proceed(File file) { FileInputStream fis = null; try { fis = new FileInputStream(file); Properties props = (Properties)PropertiesXMLHelper.read(fis, getClass().getClassLoader()); ret.setResult(props); } catch(Exception e) { ret.setException(e); } finally { if(fis!=null) { try { fis.close(); } catch(Exception e) { } } } } });
public void resultAvailable(File file) { FileOutputStream os = null; try { os = new FileOutputStream(file); PropertiesXMLHelper.write(props, os, getClass().getClassLoader()); } catch(Exception e) { System.out.println("Warning: Could not save settings: "+e); } finally { if(os!=null) { try { os.close(); } catch(Exception e) { } } } }
filename += ".launch.xml"; FileInputStream is = new FileInputStream(new File(filename)); final Properties props = (Properties)PropertiesXMLHelper.read(is, getClass().getClassLoader()); is.close();
filename += ".launch.xml"; FileOutputStream os = new FileOutputStream(new File(filename)); PropertiesXMLHelper.write(props, os, getClass().getClassLoader()); os.close();
props = (Properties)PropertiesXMLHelper.read(fis, cl); fis.close();
props = (Properties)PropertiesXMLHelper.read(fis, cl); fis.close();