本文整理汇总了Java中com.liferay.portal.kernel.util.StringUtil.read方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.read方法的具体用法?Java StringUtil.read怎么用?Java StringUtil.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readConfiguration
import com.liferay.portal.kernel.util.StringUtil; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static Map<String, Object> readConfiguration(
String configurationFile)
throws IOException, SystemException {
ClassLoader classLoader = ConfigurationUtil.class.getClassLoader();
InputStream inputStream = classLoader.getResourceAsStream(
configurationFile);
String configuration = StringUtil.read(inputStream);
String journalArticleIndexPrimaryKeyAttribute;
if (PrefsPropsUtil.getBoolean("journal.articles.index.all.versions")) {
journalArticleIndexPrimaryKeyAttribute = "pk";
}
else {
journalArticleIndexPrimaryKeyAttribute = "resourcePrimKey";
}
configuration = configuration.replace(
"$$JOURNAL_ARTICLE_INDEX_PRIMARY_KEY_ATTRIBUTE$$",
journalArticleIndexPrimaryKeyAttribute);
Yaml yaml = new Yaml();
return (Map<String, Object>)yaml.load(configuration);
}
示例2: readConfiguration
import com.liferay.portal.kernel.util.StringUtil; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static Map<String, Object> readConfiguration(
String configurationFile)
throws IOException, SystemException {
ClassLoader classLoader = ConfigurationUtil.class.getClassLoader();
InputStream inputStream = classLoader.getResourceAsStream(
configurationFile);
String configuration = StringUtil.read(inputStream);
boolean indexAllVersions;
try {
indexAllVersions = getJournalArticleIndexAllVersions();
}
catch(Exception e) {
throw new SystemException(e);
}
String journalArticleIndexPrimaryKeyAttribute;
if (indexAllVersions) {
journalArticleIndexPrimaryKeyAttribute = "pk";
}
else {
journalArticleIndexPrimaryKeyAttribute = "resourcePrimKey";
}
configuration = configuration.replace(
"$$JOURNAL_ARTICLE_INDEX_PRIMARY_KEY_ATTRIBUTE$$",
journalArticleIndexPrimaryKeyAttribute);
Yaml yaml = new Yaml();
return (Map<String, Object>)yaml.load(configuration);
}