/** * Get a section, creating it if necessary. * * @param sectionName * @return the found or created section */ private IniSection getOrCreateSection(final String sectionName) { IniSection section = sectionMap.get(sectionName); if (section == null) { section = new IniSection(sectionName); sectionMap.put(sectionName, section); list.add(sectionName); } return section; }
/** * Loads a sword config from a given File. * * @param file * the config file * @param bookRootPath * the root path for the book * @throws IOException * @throws BookException * indicates missing data files */ public SwordBookMetaData(File file, URI bookRootPath) throws IOException, BookException { this.installed = true; this.configFile = file; this.bookConf = file.getName(); // something like kjv.conf setLibrary(bookRootPath); this.configAll = new IniSection(); this.filtered = true; // Force it to run. reload(keyKeepers); }
private IniSection addConfig(MetaDataLocator locator) { // The write location supersedes the read location File conf = new File(locator.getWriteLocation(), bookConf); if (!conf.exists()) { conf = new File(locator.getReadLocation(), bookConf); } if (conf.exists()) { // The additional confs have the same encoding as the SWORD conf. String encoding = getProperty(KEY_ENCODING); try { IniSection config = new IniSection(); config.load(conf, encoding); mergeConfig(config); return config; } catch (IOException e) { LOGGER.error("Unable to load conf {}:{}", conf, e); } } return null; }
writer = new PrintWriter(out); IniSection copy = new IniSection(config);
public void parse() throws IOException { File confFile = new File(conf); if (!confFile.exists()) { System.err.println("File does not exist: " + conf); return; } IniSection config = new IniSection(); // So called Latin-1 is the default, but most are UTF-8 config.load(confFile, "UTF-8"); String encoding = config.get("Encoding"); if (encoding == null || "Latin-1".equalsIgnoreCase(encoding)) { config.clear(); config.load(confFile, "WINDOWS-1252"); } SwordBookMetaData.report(config); SwordBookMetaData.normalize(new PrintWriter(System.out), config, CANONICAL_ORDER); }
/** * Loads a sword config from a buffer gotten from mods.d.tar.gz or mods.d.zip. * * @param buffer * @param bookConf * @throws IOException * @throws BookException */ public SwordBookMetaData(byte[] buffer, String bookConf) throws IOException, BookException { this.installed = false; this.bookConf = bookConf; // something like .../mods.d.zip!mods.d/kjv.conf this.supported = true; this.configAll = new IniSection(); this.filtered = true; // Force it to run. loadBuffer(buffer, keyKeepers); adjustConfig(); report(configAll); }
case FRONTEND: if (this.configFrontend == null) { this.configFrontend = new IniSection(configAll.getName()); case JSWORD: if (this.configJSword == null) { this.configJSword = new IniSection(configAll.getName());