Code example for Properties

Methods: loadFromXML, remove, storeToXML

0
     * @throws IOException 
     */ 
    public void removeEntry(File keystoreFile) throws IOException
    { 
        Properties properties = load();
        properties.remove(keystoreFile.getAbsolutePath());
        store(properties);
    } 
 
    /** 
     * Sets backup date from a keystore  
     * @param keystoreFile The keystore file. 
     * @param backupDate The date of the backup. 
     * @throws IOException If there are problems loading the persistence file. 
     */ 
    public void setBackupDate(File keystoreFile, Date backupDate) throws IOException
    { 
        ViewStateEntry entry = getEntry(keystoreFile);
        entry.setBackupDate(backupDate);
        addEntry(keystoreFile, entry);
    } 
 
    private Properties load() throws IOException
    { 
        FileInputStream in = null;
        Properties props = new Properties();
 
        try 
        { 
            in = new FileInputStream(persistenceFile);
            props.loadFromXML(in);
        } 
        finally 
        { 
            if (in != null)
            { 
                in.close();
            } 
        } 
        return props;
    } 
 
    private void store(Properties prop) throws IOException
    { 
        FileOutputStream out = null;
 
        try 
        { 
            out = new FileOutputStream(persistenceFile);
            prop.storeToXML(out, FILE_COMMENT);
        } 
        finally 
        { 
            if (out != null)
            {