@Override public void loadFromXml(Properties props, InputStream is) throws IOException { props.loadFromXML(is); }
@Override public void loadFromXml(Properties props, InputStream is) throws IOException { props.loadFromXML(is); }
public void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException { delegate.loadFromXML(in); }
/** * Fill the given properties from the given resource (in ISO-8859-1 encoding). * @param props the Properties instance to fill * @param resource the resource to load from * @throws IOException if loading failed */ public static void fillProperties(Properties props, Resource resource) throws IOException { InputStream is = resource.getInputStream(); try { String filename = resource.getFilename(); if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) { props.loadFromXML(is); } else { props.load(is); } } finally { is.close(); } }
public SetupPreferences () { if (!file.exists()) return; InputStream in = null; try { in = new BufferedInputStream(new FileInputStream(file)); properties.loadFromXML(in); } catch (Throwable t) { t.printStackTrace(); } finally { if (in != null) try { in.close(); } catch (IOException e) { } } }
try { if (resourceName.endsWith(XML_FILE_EXTENSION)) { props.loadFromXML(is);
@Override public synchronized void loadFromXML( InputStream in ) throws IOException, InvalidPropertiesFormatException { super.putAll( storageMap ); super.loadFromXML( in ); super.forEach( ( key, value ) -> storageMap.putIfAbsent( key, value ) ); super.clear(); }
@Override public synchronized void loadFromXML(InputStream inStream) throws IOException { if (interned != null) copyFromInternedToThis(); super.loadFromXML(inStream); }
/** * Fill the given properties from the given resource (in ISO-8859-1 encoding). * @param props the Properties instance to fill * @param resource the resource to load from * @throws IOException if loading failed */ public static void fillProperties(Properties props, Resource resource) throws IOException { InputStream is = resource.getInputStream(); try { String filename = resource.getFilename(); if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) { props.loadFromXML(is); } else { props.load(is); } } finally { is.close(); } }
public Lwjgl3Preferences (FileHandle file) { this.file = file; if (!file.exists()) return; InputStream in = null; try { in = new BufferedInputStream(file.read()); properties.loadFromXML(in); } catch (Throwable t) { t.printStackTrace(); } finally { StreamUtils.closeQuietly(in); } }
public HeadlessPreferences(FileHandle file) { this.file = file; if (!file.exists()) return; InputStream in = null; try { in = new BufferedInputStream(file.read()); properties.loadFromXML(in); } catch (Throwable t) { t.printStackTrace(); } finally { StreamUtils.closeQuietly(in); } }
public HeadlessPreferences(FileHandle file) { this.file = file; if (!file.exists()) return; InputStream in = null; try { in = new BufferedInputStream(file.read()); properties.loadFromXML(in); } catch (Throwable t) { t.printStackTrace(); } finally { StreamUtils.closeQuietly(in); } }
public Lwjgl3Preferences (FileHandle file) { this.file = file; if (!file.exists()) return; InputStream in = null; try { in = new BufferedInputStream(file.read()); properties.loadFromXML(in); } catch (Throwable t) { t.printStackTrace(); } finally { StreamUtils.closeQuietly(in); } }
void load(String file) throws IOException { try { Properties mainProperties = new Properties(); try (InputStream inputStream = new FileInputStream(file)) { mainProperties.loadFromXML(inputStream); } String defaultConfigFile = mainProperties.getProperty("config.default"); if (defaultConfigFile != null) { try (InputStream inputStream = new FileInputStream(defaultConfigFile)) { properties.loadFromXML(inputStream); } } properties.putAll(mainProperties); // override defaults useEnvironmentVariables = Boolean.parseBoolean(System.getenv("CONFIG_USE_ENVIRONMENT_VARIABLES")) || Boolean.parseBoolean(properties.getProperty("config.useEnvironmentVariables")); } catch (InvalidPropertiesFormatException e) { throw new RuntimeException("Configuration file is not a valid XML document", e); } }
public Properties getKettleProperties() throws Exception { String xml = execService( GetPropertiesServlet.CONTEXT_PATH + "/?xml=Y" ); String decryptedXml = Encr.decryptPassword( xml ); InputStream in = new ByteArrayInputStream( decryptedXml.getBytes() ); Properties properties = new Properties(); properties.loadFromXML( in ); return properties; }
/** * Determines if the the input stream is xml if it is, use create properties loaded from xml * format, otherwise create properties from default format. * * @param in * @throws IOException */ public static Properties loadUniversal(InputStream in) throws IOException { final String xmlDeclarationStart = "<?xml"; BufferedInputStream bin = new BufferedInputStream(in); bin.mark(4096); BufferedReader reader = new BufferedReader(new InputStreamReader(bin)); String line = reader.readLine(); boolean isXML = line.startsWith(xmlDeclarationStart); bin.reset(); Properties props = new Properties(); if (isXML) props.loadFromXML(bin); else props.load(bin); return props; }
properties.loadFromXML(inStream); } else { properties.load(inStream);
public LwjglPreferences (FileHandle file) { this.name = file.name(); this.file = file; if (!file.exists()) return; InputStream in = null; try { in = new BufferedInputStream(file.read()); properties.loadFromXML(in); } catch (Throwable t) { t.printStackTrace(); } finally { StreamUtils.closeQuietly(in); } }
public LwjglPreferences (FileHandle file) { this.name = file.name(); this.file = file; if (!file.exists()) return; InputStream in = null; try { in = new BufferedInputStream(file.read()); properties.loadFromXML(in); } catch (Throwable t) { t.printStackTrace(); } finally { StreamUtils.closeQuietly(in); } }
private Dictionary(Configuration cfg) { this.configuration = cfg; this.props = new Properties(); this.conf_dir = cfg.getEnvironment().configFile().resolve(AnalysisIkPlugin.PLUGIN_NAME); Path configFile = conf_dir.resolve(FILE_NAME); InputStream input = null; try { logger.info("try load config from {}", configFile); input = new FileInputStream(configFile.toFile()); } catch (FileNotFoundException e) { conf_dir = cfg.getConfigInPluginDir(); configFile = conf_dir.resolve(FILE_NAME); try { logger.info("try load config from {}", configFile); input = new FileInputStream(configFile.toFile()); } catch (FileNotFoundException ex) { // We should report origin exception logger.error("ik-analyzer", e); } } if (input != null) { try { props.loadFromXML(input); } catch (InvalidPropertiesFormatException e) { logger.error("ik-analyzer", e); } catch (IOException e) { logger.error("ik-analyzer", e); } } }