mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-25 20:55:59 +10:00
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-commons/trunk@686 84d0f5b1-2673-498c-a247-62c4ff18d310
33 lines
941 B
Java
33 lines
941 B
Java
package com.profiler.common.util;
|
|
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.util.Properties;
|
|
|
|
public class PropertyUtils {
|
|
|
|
public static Properties readProperties(String propertyName) {
|
|
return readProperties(propertyName, PropertyUtils.class.getClassLoader());
|
|
}
|
|
|
|
public static Properties readProperties(String propertyName, ClassLoader cl) {
|
|
Properties properties = new Properties();
|
|
InputStream stream = cl.getResourceAsStream(propertyName);
|
|
if (stream == null) {
|
|
throw new RuntimeException(propertyName + " not found.");
|
|
}
|
|
try {
|
|
properties.load(stream);
|
|
} catch (IOException e) {
|
|
throw new RuntimeException(propertyName + " load fail. Cause:" + e.getMessage(), e);
|
|
} finally {
|
|
try {
|
|
stream.close();
|
|
} catch (IOException e) {
|
|
// 무시
|
|
}
|
|
}
|
|
return properties;
|
|
}
|
|
}
|