本文整理汇总了Java中org.apache.camel.util.ObjectHelper.after方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectHelper.after方法的具体用法?Java ObjectHelper.after怎么用?Java ObjectHelper.after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.util.ObjectHelper
的用法示例。
在下文中一共展示了ObjectHelper.after方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadPropertiesFromFilePath
import org.apache.camel.util.ObjectHelper; //导入方法依赖的package包/类
private Properties loadPropertiesFromFilePath(boolean ignoreMissingLocation, String path, String encoding) throws IOException {
Properties answer = new Properties();
if (path.startsWith("file:")) {
path = ObjectHelper.after(path, "file:");
}
InputStream is = null;
Reader reader = null;
try {
is = new FileInputStream(path);
if (encoding != null) {
reader = new BufferedReader(new InputStreamReader(is, encoding));
answer.load(reader);
} else {
answer.load(is);
}
} catch (FileNotFoundException e) {
if (!ignoreMissingLocation) {
throw e;
}
} finally {
IOHelper.close(reader, is);
}
return answer;
}
示例2: loadPropertiesFromClasspath
import org.apache.camel.util.ObjectHelper; //导入方法依赖的package包/类
private Properties loadPropertiesFromClasspath(boolean ignoreMissingLocation, String path, String encoding) throws IOException {
Properties answer = new Properties();
if (path.startsWith("classpath:")) {
path = ObjectHelper.after(path, "classpath:");
}
if(!path.startsWith("/")){
path = "/" + path;
}
InputStream is = propLocator.getClass().getResourceAsStream(path);
Reader reader = null;
if (is == null) {
if (!ignoreMissingLocation) {
throw new FileNotFoundException("Properties file " + path + " not found in classpath");
}
} else {
try {
if (encoding != null) {
reader = new BufferedReader(new InputStreamReader(is, encoding));
answer.load(reader);
} else {
answer.load(is);
}
} finally {
IOHelper.close(reader, is);
}
}
return answer;
}