List of utility methods to do Properties Load from File
Properties | loadProperties(final Class> clasz, final String propertiesFilename) Loads a properties file. final Properties props = new Properties(); final InputStream inStream = clasz.getResourceAsStream(propertiesFilename); if (inStream == null) { throw new IOException("Resource '" + propertiesFilename + "' not found!"); try { props.load(inStream); } finally { ... |
Properties | loadProperties(final File f) load Properties Properties properties = new Properties(); properties.load(new FileInputStream(f)); return properties; |
Properties | loadProperties(final File propertiesFile) Reads the properties from the specified file, and loads them into a Properties object. final Properties properties = new Properties(); final FileInputStream fis = new FileInputStream(propertiesFile); try { properties.load(fis); } finally { fis.close(); return properties; ... |
Properties | loadProperties(final String file) load Properties final Properties props = new Properties(); FileReader fr = null; try { fr = new FileReader(file); props.load(fr); return props; } catch (final FileNotFoundException fe) { System.out.println("File not found" + file); ... |
Properties | loadProperties(final String fileName) load Properties return loadProperties("", fileName); |
Properties | loadProperties(final ZipFile file, final ZipEntry ze) load Properties final Properties p = new Properties(); p.load(file.getInputStream(ze)); return p; |
Properties | loadProperties(JarFile enclosedJarFile, String jarEntryPath) Loads the properties file residing inside a jar. JarEntry jarEntry = enclosedJarFile.getJarEntry(jarEntryPath); InputStream inputStream = enclosedJarFile.getInputStream(jarEntry); Properties properties = new Properties(); properties.load(inputStream); return properties; |
void | loadProperties(Map load Properties BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding)); String key = null; String line; int cpt = 1; while ((line = br.readLine()) != null) { if (line.length() != 0) { ... |
Map | loadProperties(ProcessingEnvironment env, String fileName) Attempts to load fileName and return its properties. Map<String, String> properties = new LinkedHashMap<String, String>(); File file = null; for (Location location : new Location[] { StandardLocation.SOURCE_OUTPUT, StandardLocation.CLASS_OUTPUT }) { file = resolveBindgenPropertiesIfExists(location, env, fileName); if (file != null) { break; if (file != null) { Properties p = new Properties(); try { p.load(new FileInputStream(file)); } catch (Exception e) { e.printStackTrace(); for (Map.Entry<Object, Object> entry : p.entrySet()) { properties.put((String) entry.getKey(), (String) entry.getValue()); return properties; |
Properties | loadProperties(Properties properties, File file) load Properties try (InputStream propertiesStream = new FileInputStream(file)) { return loadProperties(properties, propertiesStream); |