Added another version of loadAndGet().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1291 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PropertiesUtil.java,v 1.7 2003/11/13 00:05:08 mdb Exp $
|
||||
// $Id: PropertiesUtil.java,v 1.8 2003/11/13 00:08:11 mdb Exp $
|
||||
//
|
||||
// samskivert library - useful routines for java programs
|
||||
// Copyright (C) 2001 Michael Bayne
|
||||
@@ -136,4 +136,21 @@ public class PropertiesUtil
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #loadAndGet(File,String)} but obtains the properties
|
||||
* data via the classloader.
|
||||
*
|
||||
* @return the value of the key in question or null if no such key
|
||||
* exists or an error occurred loading the properties file.
|
||||
*/
|
||||
public String loadAndGet (String loaderPath, String key)
|
||||
{
|
||||
try {
|
||||
Properties props = ConfigUtil.loadProperties(loaderPath);
|
||||
return props.getProperty(key);
|
||||
} catch (IOException ioe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user