本文整理汇总了Java中com.liferay.portal.kernel.util.FileUtil.getExtension方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.getExtension方法的具体用法?Java FileUtil.getExtension怎么用?Java FileUtil.getExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.util.FileUtil
的用法示例。
在下文中一共展示了FileUtil.getExtension方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLayoutTemplate
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected void addLayoutTemplate(String dirName) throws Exception {
Set<String> resourcePaths = servletContext.getResourcePaths(
resourcesDir.concat(dirName));
if (resourcePaths == null) {
return;
}
for (String resourcePath : resourcePaths) {
String extension = FileUtil.getExtension(resourcePath);
if (!extension.equals("json")) {
return;
}
URL url = servletContext.getResource(resourcePath);
URLConnection urlConnection = url.openConnection();
addLayoutTemplate(urlConnection.getInputStream());
}
}
示例2: getDDMTemplateLanguage
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected String getDDMTemplateLanguage(String fileName) {
String extension = FileUtil.getExtension(fileName);
if (extension.equals(TemplateConstants.LANG_TYPE_CSS) ||
extension.equals(TemplateConstants.LANG_TYPE_FTL) ||
extension.equals(TemplateConstants.LANG_TYPE_VM) ||
extension.equals(TemplateConstants.LANG_TYPE_XSL)) {
return extension;
}
return TemplateConstants.LANG_TYPE_VM;
}
示例3: importData
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected void importData(ActionRequest actionRequest, String fileName, InputStream inputStream) throws Exception {
_log.info("importData()");
String extension = FileUtil.getExtension(fileName);
_log.info("extension = " + extension);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long groupId = ParamUtil.getLong(actionRequest, "groupId");
boolean privateLayout = ParamUtil.getBoolean(actionRequest, "privateLayout");
// TODO: remove dependency from ExportImportConfigurationSettingsMapFactory (see below)
Map<String, Serializable> importLayoutSettingsMap = ExportImportConfigurationSettingsMapFactory
.buildImportLayoutSettingsMap(themeDisplay.getUserId(), groupId, privateLayout, null,
actionRequest.getParameterMap(), themeDisplay.getLocale(), themeDisplay.getTimeZone());
ExportImportConfiguration exportImportConfiguration = _exportImportConfigurationLocalService
.addDraftExportImportConfiguration(themeDisplay.getUserId(),
ExportImportConfigurationConstants.TYPE_IMPORT_LAYOUT, importLayoutSettingsMap);
_taskRecordService.importTaskRecordsInBackground(exportImportConfiguration, inputStream, extension);
}
示例4: importData
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected void importData(ActionRequest actionRequest, String fileName, InputStream inputStream) throws Exception {
_log.info("importData()");
String extension = FileUtil.getExtension(fileName);
_log.info("extension = " + extension);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long groupId = ParamUtil.getLong(actionRequest, "groupId");
Map<String, Serializable> importMeasurementSettingsMap = ExportImportConfigurationSettingsMapFactory
.buildImportMeasurementsSettingsMap(themeDisplay.getUserId(), groupId, actionRequest.getParameterMap(),
themeDisplay.getLocale(), themeDisplay.getTimeZone());
// TODO: reconsider addDraft...
// TODO: reconsider TYPE_IMPORT_LAYOUT
ExportImportConfiguration exportImportConfiguration = _exportImportConfigurationLocalService
.addDraftExportImportConfiguration(themeDisplay.getUserId(),
ExportImportConfigurationConstants.TYPE_IMPORT_LAYOUT, importMeasurementSettingsMap);
_measurementService.importMeasurementsInBackground(exportImportConfiguration, inputStream, extension);
}
示例5: importData
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
protected void importData(ActionRequest actionRequest, String fileName, InputStream inputStream) throws Exception {
_log.info("importData()");
String extension = FileUtil.getExtension(fileName);
_log.info("extension = " + extension);
ExportImportConfiguration exportImportConfiguration = getExportImportConfiguration(actionRequest);
_contactService.importContactsInBackground(exportImportConfiguration, inputStream, extension);
}
示例6: getFileName
import com.liferay.portal.kernel.util.FileUtil; //导入方法依赖的package包/类
/**
* Auto generate filename for comunicate with multi system
*
* @param sourceFileName
* @return
*/
private static String getFileName(String sourceFileName) {
String ext = FileUtil.getExtension(sourceFileName);
return System.currentTimeMillis() + "." + ext;
}