/** * method to save the recent file with its attributes to the config file * * @throws FileNotFoundException * @throws IOException */ private void save() throws FileNotFoundException, IOException { // the recent file object RecentFile recentFile; // the index i represents the file index int i = 0; // the index j represents the attribute index int j = 0; // clear all properties properties.clear(); // from the recent file list create properties object for (i = 0; i < recentFilesList.size(); i++) { // get the recent file object recentFile = recentFilesList.get(i); // reset the j index value for iterations j = 0; // set the file property - the key for file will be '00' // file absolute path is saved as value for the file key properties.setProperty( String.valueOf(i) + String.valueOf(j), recentFile.getFile().getAbsolutePath()); // save the attributres for the file // only if the recent file have any attribute if (recentFile.getAttributes() != null) { for (String attributes : recentFile.getAttributes()) { // increment the attrbutes index j++; // set the attribute for the file properties.setProperty(String.valueOf(i) + String.valueOf(j), attributes); } } } // save the properties object to the config file properties.store(new FileOutputStream(configFile), null); }