List of utility methods to do Properties Load
ImmutableMap | loadProperties(ByteSource is) load Properties Properties props = new Properties(); Closer closer = Closer.create(); InputStream in = closer.register(is.openStream()); try { props.load(in); } finally { closer.close(); return Maps.fromProperties(props); |
Properties | loadProperties(Class clazz, String name) load Properties InputStream inputStream = clazz.getResourceAsStream(name); Properties properties = new Properties(); try { properties.load(inputStream); } catch (Exception e) { return properties; |
Properties | loadProperties(Class> clazz) Load local class properties. Properties retval = new Properties(); String propfilename = clazz.getSimpleName() + ".properties"; retval.load(clazz.getResourceAsStream(propfilename)); return retval; |
Properties | loadProperties(Class> clazz, String name) load Properties Properties prop = new Properties(); InputStream in = null; try { in = clazz.getResourceAsStream(name); prop.load(in); } finally { closeQuietly(in); return prop; |
void | loadProperties(Properties p, String progname) load Properties String fileName = (progname + ".properties"); try { InputStream is = new FileInputStream(fileName); p.load(is); is.close(); } catch (IOException e) { System.err.println("Cannot read " + fileName); return; ... |
void | loadProperties(Properties properties, Class clazz, String propDir, String name) load Properties try { properties.load(clazz.getResourceAsStream(name)); } catch (IOException ioe) { System.err.println("Could not load aid property file: " + name); System.err.println(ioe); try { if ((propDir != null) && !propDir.equals(".") && !propDir.equals("")) { ... |
Properties | loadProperties(Properties properties, Class> baseClass, String... propertiesName) load Properties if (properties == null) { properties = new Properties(); for (String propertyName : propertiesName) { properties = loadProperties(properties, baseClass, propertyName); return properties; |
void | loadProperties(Properties props, final Class clazz, final String resourceName) Load properties from a resource. BufferedInputStream in = null; try { in = new BufferedInputStream(clazz.getResourceAsStream(resourceName)); props.load(in); } catch (IOException ex) { System.err.println("I/O exception while loading \"" + resourceName + "\": " + ex.getMessage()); } finally { if (in != null) { ... |
Properties | loadProperties(String bucketName, String key) load Properties Properties props = new Properties(); AmazonS3 s3Client = new AmazonS3Client(new ProfileCredentialsProvider()); S3Object s3object = s3Client.getObject(new GetObjectRequest(bucketName, key)); props.load(s3object.getObjectContent()); return props; |
Properties | loadProperties(String conf) load Properties Properties macros = new Properties(); macros.setProperty("%BASE%", new File(conf).getAbsoluteFile().getParent()); Properties p = new Properties(); FileInputStream fin = new FileInputStream(conf); try { p.load(fin); for (Object o1 : p.keySet()) { String k1 = (String) o1; ... |