Package java.util

Examples of java.util.Properties.store()


                properties.setProperty("hsqldb.nio_data_file", "true");
                properties.setProperty("hsqldb.default_table_type", "memory");
                properties.setProperty("hsqldb.lock_file", "false");
                properties.setProperty("hsqldb.log_size", "1000");

                properties.store(new FileOutputStream(file), "Default properties for the DC database of Data Crow.");
            }
        } catch (Exception e) {
            logger.error("Could not set the default database properties.", e);
        }
    }   
View Full Code Here


        users.setProperty("ftpserver.user.user3.userpassword", "");
        users.setProperty("ftpserver.user.user3.homedirectory", "home");

        FileOutputStream fos = new FileOutputStream(USERS_FILE);
        users.store(fos, null);

        fos.close();
    }

    @Override
View Full Code Here

    public void testRefresh() throws FileNotFoundException, IOException {
      Properties users = new Properties();
      users.load(new FileInputStream(USERS_FILE));
      String originalSetting = users.getProperty("ftpserver.user.user1.homedirectory");
      users.setProperty("ftpserver.user.user1.homedirectory", "refresh_test");
      users.store(new FileOutputStream(USERS_FILE), null);
     
      PropertiesUserManager pum = (PropertiesUserManager) userManager;
      pum.refresh();
      User modifiedUser = pum.getUserByName("user1");
      assertEquals("Home directory should have been \"refresh_test\" after call to refresh().","refresh_test",modifiedUser.getHomeDirectory());
View Full Code Here

      User modifiedUser = pum.getUserByName("user1");
      assertEquals("Home directory should have been \"refresh_test\" after call to refresh().","refresh_test",modifiedUser.getHomeDirectory());
      // set everything back again
      users.load(new FileInputStream(USERS_FILE));
      users.setProperty("ftpserver.user.user1.homedirectory", originalSetting);
      users.store(new FileOutputStream(USERS_FILE), null);
     
      pum.refresh();
      //check everything is back again
      modifiedUser = pum.getUserByName("user1");
      assertEquals("Home directory should have reset back to \""+originalSetting+"\" after second call to refresh().",originalSetting,modifiedUser.getHomeDirectory());
View Full Code Here

    try
    {
      final OutputStream out = new BufferedOutputStream(new FileOutputStream(target));
      try
      {
        properties.store(out, FileConfigStorage.CONFIGHEADER);
      }
      finally
      {
        out.close();
      }
View Full Code Here

        for (Conversion conversion : conversions) {
            properties.put(String.valueOf(count), conversion.toString());
        }
       
        try {
            properties.store(new FileOutputStream(new File(filename)), "");
        } catch (IOException e) {
            logger.error("Failed to persist database column conversion scripts", e);
        }           
    }
}
View Full Code Here

                properties.setProperty(setting.getKey(), setting.getValueAsString());
        }

        try {
            FileOutputStream fos = new FileOutputStream(settings.getSettingsFile());
            properties.store(fos, "");
            fos.close();
        } catch (Exception e) {
            logger.error("Could not save settings to file " + settings.getSettingsFile(), e);
        }
    }
View Full Code Here

                File parentDir = new File(propFile.getParent());
                parentDir.mkdirs();

                propFile.createNewFile();
                FileOutputStream fos = new FileOutputStream(propFile);
                props.store(fos, "I18N Resource File");
                fos.close();
            } catch (FileNotFoundException fnfe) {
                fnfe.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
View Full Code Here

            // write new values
            FileOutputStream fileOut = null;
            try {
                fileOut = new FileOutputStream(new File("DATA/SETTINGS/profile.txt"));
                profile.store(fileOut , null );

                // generate a news message
                final Properties news = profile;
                news.remove("comment");
                sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), yacyNewsPool.CATEGORY_PROFILE_UPDATE, news);
View Full Code Here

   // retrieve property
   Properties properties = getProperties();

   // try to save to the original loading place
   OutputStream out = new FileOutputStream(saveFile);
   properties.store(out, "JUtils property file, including system properties");
   out.close();
   System.out.println("Property: Done.");

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