Java Utililty Methods Properties Load

List of utility methods to do Properties Load

Description

The list of methods to do Properties Load are organized into topic(s).

Method

ImmutableMaploadProperties(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);
PropertiesloadProperties(Class clazz, String name)
load Properties
InputStream inputStream = clazz.getResourceAsStream(name);
Properties properties = new Properties();
try {
    properties.load(inputStream);
} catch (Exception e) {
return properties;
PropertiesloadProperties(Class clazz)
Load local class properties.
Properties retval = new Properties();
String propfilename = clazz.getSimpleName() + ".properties";
retval.load(clazz.getResourceAsStream(propfilename));
return retval;
PropertiesloadProperties(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;
voidloadProperties(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;
...
voidloadProperties(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("")) {
...
PropertiesloadProperties(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;
voidloadProperties(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) {
...
PropertiesloadProperties(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;
PropertiesloadProperties(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;
...