本文整理匯總了Java中org.ini4j.Ini.store方法的典型用法代碼示例。如果您正苦於以下問題:Java Ini.store方法的具體用法?Java Ini.store怎麽用?Java Ini.store使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.ini4j.Ini
的用法示例。
在下文中一共展示了Ini.store方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: write
import org.ini4j.Ini; //導入方法依賴的package包/類
/**
* Write the object to a Writer.
*
* @param out
* Stream to write object out to.
*/
public void write(Writer out) throws IOException {
Ini configIni = new Ini();
Section section = configIni.add(SECTION_NAME);
section.put("algorithm", algorithm.toString());
section.put("provider", provider);
section.put("destination", destination.toString());
if (destinationTable != null) {
section.put("table", destinationTable);
}
if (defaultVisibility != null) {
section.put("defaultVisibility", new String(defaultVisibility, VISIBILITY_CHARSET));
}
configIni.store(out);
}
示例2: testWithStrictOperator
import org.ini4j.Ini; //導入方法依賴的package包/類
@Test public void testWithStrictOperator() throws Exception
{
Config cfg = new Config();
cfg.setStrictOperator(true);
Ini ini = new Ini();
Ini.Section sec = ini.add(Dwarfs.PROP_BASHFUL);
sec.put(Dwarf.PROP_AGE, DwarfsData.bashful.age);
ini.setConfig(cfg);
StringWriter writer = new StringWriter();
ini.store(writer);
StringBuilder exp = new StringBuilder();
exp.append(IniParser.SECTION_BEGIN);
exp.append(Dwarfs.PROP_BASHFUL);
exp.append(IniParser.SECTION_END);
exp.append(NL);
exp.append(Dwarf.PROP_AGE);
exp.append('=');
exp.append(DwarfsData.bashful.age);
exp.append(NL);
exp.append(NL);
assertEquals(exp.toString(), writer.toString());
}
示例3: createUserConfFile
import org.ini4j.Ini; //導入方法依賴的package包/類
private void createUserConfFile(Ca ca,
Map<String, String> subjAlt) throws Exception {
File f = new File(ca.getUserConfFileName());
Ini confFile = new Ini(f);
Ini.Section sect;
sect = confFile.get("v3_req");
sect.put("basicConstraints", "CA:FALSE");
sect.put("keyUsage", "cRLSign, digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign");
sect.put("subjectKeyIdentifier", "hash");
sect.put("certificatePolicies", "@polsection");
sect = confFile.get("v3_ca");
sect.put("basicConstraints", "critical,CA:FALSE");
sect.put("keyUsage", "digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign");
sect.put("authorityKeyIdentifier", "keyid,issuer:always");
sect.put("certificatePolicies", "@polsection");
sect.put("subjectAltName", "@subject_alt_section");
sect = confFile.get("subject_alt_section");
sect.clear();
for (String key : subjAlt.keySet()) {
sect.put(key, subjAlt.get(key));
}
confFile.store();
}
示例4: createCaConfFile
import org.ini4j.Ini; //導入方法依賴的package包/類
@Override
protected void createCaConfFile(Ca rootCa, Ca ca, String crlURI,
String cpsURI, String subject) throws Exception {
super.createCaConfFile(rootCa, ca, crlURI, cpsURI, subject);
File f = new File(ca.getConfFileName());
Ini confFile = new Ini(f);
Ini.Section sect;
sect = confFile.get("v3_req");
sect.put("certificatePolicies", "@polsection1, @polsection2");
sect = confFile.get("v3_ca");
sect.put("authorityKeyIdentifier", "keyid,issuer:always");
sect.put("certificatePolicies", "@polsection1, @polsection2");
sect = confFile.add("polsection1");
sect.put("policyIdentifier", cpsCaA1);
sect.put("CPS.1", "\"" + cpsURI + "\"");
sect = confFile.add("polsection2");
sect.put("policyIdentifier", cpsCaA3);
sect.put("CPS.1", "\"" + cpsURI + "\"");
confFile.store();
}
示例5: createHandleManagerDeployCfg
import org.ini4j.Ini; //導入方法依賴的package包/類
private File createHandleManagerDeployCfg(
final AuthToken shockAdminToken,
final String allowedUser,
final URL authServiceURL)
throws IOException {
final File iniFile = tempDir.resolve("handleManager.cfg").toFile();
if (iniFile.exists()) {
iniFile.delete();
}
final Ini ini = new Ini();
final Section hm = ini.add("HandleMngr");
hm.add("handle-service-url", "http://localhost:" + handleServicePort);
hm.add("service-host", "localhost");
hm.add("service-port", "" + handleManagerPort);
hm.add("auth-service-url", authServiceURL.toString());
hm.add("admin-token", shockAdminToken.getToken());
hm.add("allowed-users", allowedUser);
ini.store(iniFile);
return iniFile;
}
示例6: createHandleServiceDeployCfg
import org.ini4j.Ini; //導入方法依賴的package包/類
private File createHandleServiceDeployCfg(
final MySQLController mysql,
final String shockHost,
final URL authServiceURL) throws IOException {
final File iniFile = tempDir.resolve("handleService.cfg").toFile();
if (iniFile.exists()) {
iniFile.delete();
}
final Ini ini = new Ini();
final Section hs = ini.add(HANDLE_SERVICE_NAME);
hs.add("self-url", "http://localhost:" + handleServicePort);
hs.add("service-port", "" + handleServicePort);
hs.add("service-host", "localhost");
hs.add("auth-service-url", authServiceURL.toString());
hs.add("default-shock-server", shockHost);
hs.add("mysql-host", "127.0.0.1");
hs.add("mysql-port", "" + mysql.getServerPort());
hs.add("mysql-user", USER);
hs.add("mysql-pass", PWD);
hs.add("data-source", "dbi:mysql:" + DB);
ini.store(iniFile);
return iniFile;
}
示例7: overrideBuckconfig
import org.ini4j.Ini; //導入方法依賴的package包/類
public static void overrideBuckconfig(
ProjectWorkspace projectWorkspace,
Map<String, ? extends Map<String, String>> buckconfigOverrides)
throws IOException {
String config = projectWorkspace.getFileContents(".buckconfig");
Ini ini = new Ini(new StringReader(config));
for (Map.Entry<String, ? extends Map<String, String>> section :
buckconfigOverrides.entrySet()) {
for (Map.Entry<String, String> entry : section.getValue().entrySet()) {
ini.put(section.getKey(), entry.getKey(), entry.getValue());
}
}
StringWriter writer = new StringWriter();
ini.store(writer);
Files.write(projectWorkspace.getPath(".buckconfig"), writer.toString().getBytes(UTF_8));
}
示例8: storeSession
import org.ini4j.Ini; //導入方法依賴的package包/類
/**Stores a session with all back end modules and the Splitter's configuration**/
public void storeSession(int sessionNumber){
try{
String dbPath = System.getProperty("user.home")+"/.nubisave/nubisavemount/data/.nubisave_database"+sessionNumber;
//store the back end modules:
File dir = new File(dataDir+"/.nubisave_session_"+sessionNumber);
dir.mkdirs();
Nubisave.services.storeToDatabase(dataDir+"/.nubisave_session_"+sessionNumber);
FileUtil.copy(new File(new PropertiesUtil("nubi.properties").getProperty("splitter_database_location")+".db"), new File(dbPath));
Ini splitterConfig = new Ini(new File(configurationFilePath));
splitterConfig.put("splitter", "save", sessionNumber);
System.out.println( "gui db path: "+"/.nubisave_database"+sessionNumber);
splitterConfig.put("database", "path", "/.nubisave_database"+sessionNumber);
splitterConfig.store();
} catch(Exception e){
System.err.println("Splitter.storeSession(int sessionNumber): Failed to configure Splitter "+" - "+e.getMessage()==null?e.getMessage():"");
}
}
示例9: write
import org.ini4j.Ini; //導入方法依賴的package包/類
/**
* Write the object to a Writer.
*
* @param out
* Stream to write object out to.
*/
public void write(Writer out) throws IOException {
Ini configIni = new Ini();
for (FieldEncryptorConfig config : fieldEncryptorConfigs) {
config.write(configIni);
}
configIni.store(out);
}
示例10: verify
import org.ini4j.Ini; //導入方法依賴的package包/類
private void verify(Ini ini, IniHandler mock) throws Exception
{
StringWriter writer = new StringWriter();
ini.store(writer);
IniParser parser = new IniParser();
parser.parse(new StringReader(writer.toString()), mock);
EasyMock.verify(mock);
}
示例11: main
import org.ini4j.Ini; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception
{
Ini ini = new Ini();
DwarfBean doc = new DwarfBean();
doc.setAge(123);
doc.setHeight(111);
doc.setWeight(22.1);
doc.setHomePage(new URI("http://foo.bar"));
ini.add("doc").from(doc);
ini.store(System.out);
}
示例12: save
import org.ini4j.Ini; //導入方法依賴的package包/類
private static void save(Ini ini) throws IOException {
String homeDir = getSaveDirectory();
if (homeDir != null) {
File propsFile = new File(homeDir, PREFERENCES_NAME);
ini.store(propsFile);
}
}
示例13: createUserConfFile
import org.ini4j.Ini; //導入方法依賴的package包/類
protected void createUserConfFile(Ca rootCa, Ca ca, String crlURI,
String cpsURI, String subject) throws Exception {
createConfFile(ca.getUserConfFileName(), rootCa, ca, crlURI, cpsURI, subject);
File f = new File(ca.getUserConfFileName());
Ini confFile = new Ini(f);
Ini.Section sect;
sect = confFile.get("v3_req");
sect.put("basicConstraints", "CA:FALSE");
sect.put("keyUsage", "cRLSign, digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign");
sect.put("subjectKeyIdentifier", "hash");
sect.put("crlDistributionPoints", "URI:" + crlURI);
sect.put("certificatePolicies", "@polsection");
sect.put("extendedKeyUsage", "serverAuth, clientAuth, codeSigning, emailProtection, timeStamping, 1.3.6.1.4.1.311.20.2.2");
sect = confFile.get("v3_ca");
sect.put("basicConstraints", "critical,CA:FALSE");
sect.put("keyUsage", "digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment");
sect.put("authorityKeyIdentifier", "keyid,issuer:always");
sect.put("crlDistributionPoints", "URI:" + crlURI);
sect.put("certificatePolicies", "@polsection");
sect.put("extendedKeyUsage", "serverAuth, clientAuth, codeSigning, emailProtection, timeStamping, 1.3.6.1.4.1.311.20.2.2");
sect.put("subjectAltName", "@subject_alt_section");
sect = confFile.get("polsection");
sect.put("policyIdentifier", cpsCaA3);
sect.put("CPS.1", "\"" + cpsURI + "\"");
sect = confFile.get("req");
sect.put("default_bits", "1024");
sect = confFile.add("subject_alt_section");
sect.put("subjectAltName", "");
confFile.store();
}
示例14: createEcpfConfFile
import org.ini4j.Ini; //導入方法依賴的package包/類
private void createEcpfConfFile(Ca ca,
Map<String, String> subjAlt) throws Exception {
createUserConfFile(ca, subjAlt);
File f = new File(ca.getUserConfFileName());
Ini confFile = new Ini(f);
Ini.Section sect;
sect = confFile.get("v3_req");
sect.put("extendedKeyUsage", ECPF_EXTENDED_KEY_USAGE);
sect = confFile.get("v3_ca");
sect.put("extendedKeyUsage", ECPF_EXTENDED_KEY_USAGE);
sect = confFile.get("polsection");
sect.put("policyIdentifier", cpsCaA3PF);
confFile.store();
}
示例15: createEcnpjConfFile
import org.ini4j.Ini; //導入方法依賴的package包/類
private void createEcnpjConfFile(Ca ca,
Map<String, String> subjAlt) throws Exception {
createUserConfFile(ca, subjAlt);
File f = new File(ca.getUserConfFileName());
Ini confFile = new Ini(f);
Ini.Section sect;
sect = confFile.get("v3_req");
sect.put("extendedKeyUsage", ECNPJ_EXTENDED_KEY_USAGE);
sect = confFile.get("v3_ca");
sect.put("extendedKeyUsage", ECNPJ_EXTENDED_KEY_USAGE);
sect = confFile.get("polsection");
sect.put("policyIdentifier", cpsCaA3PJ);
confFile.store();
}