本文整理汇总了Java中org.ini4j.Wini.load方法的典型用法代码示例。如果您正苦于以下问题:Java Wini.load方法的具体用法?Java Wini.load怎么用?Java Wini.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ini4j.Wini
的用法示例。
在下文中一共展示了Wini.load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Mod
import org.ini4j.Wini; //导入方法依赖的package包/类
/**
* Loads a moddesc from a stream of bytes. Typically this is from a
* compressed archive.
*
* @param bytes
*/
public Mod(ByteArrayInOutStream bytes) {
modDescFile = new File(System.getProperty("user.dir"));
ignoreLoadErrors = true;
modifyString = "";
jobs = new ArrayList<ModJob>();
try {
Wini wini = new Wini();
wini.load(bytes.getInputStream());
readDesc(wini);
} catch (Exception e) {
ModManager.debugLogger.writeErrorWithException("Error reading moddesc.ini from stream:", e);
setValidMod(false);
return;
}
}
示例2: main
import org.ini4j.Wini; //导入方法依赖的package包/类
public static void main(String[] args)
{
try
{
BasicConfigurator.configure(); // TODO: config from options
// Parse the command line options
CliOptions options = new CliOptions();
new JCommander(options, args);
if (StringUtils.isBlank(options.configFile))
{
options.configFile = "/etc/car-counter/car-counter.conf";
}
// Read in the configuration
Wini ini = new Wini();
ini.getConfig().setMultiOption(true);
ini.load(new File(options.configFile));
new DefaultProcessor(ini).process();
}
catch (Exception e)
{
Logger.getLogger(Main.class).fatal("Unhandled exception - quitting", e);
}
}
示例3: setUp
import org.ini4j.Wini; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception
{
BasicConfigurator.configure();
dbFile = Files.createTempFile("test", ".db");
tempDirectory = Files.createTempDirectory("test");
incoming = tempDirectory.resolve("incoming");
data = tempDirectory.resolve("data");
Files.createDirectories(incoming);
Files.createDirectories(data);
String iniValue = String.format(
"[Counting]\n" +
"implementation = noop\n" +
"[Storage]\n" +
"implementation = sqlite\n" +
"database = %s\n" +
"[Processing]\n" +
"incoming = %s\n" +
"data = %s\n",
dbFile, incoming, data);
ini = new Wini();
ini.getConfig().setMultiOption(true);
try (InputStream stream = IOUtils.toInputStream(iniValue, StandardCharsets.UTF_8))
{
ini.load(stream);
}
}