001
014
015 package com.liferay.portal.kernel.util;
016
017 import java.io.File;
018 import java.io.InputStream;
019
020
023 public class DocumentConversionUtil {
024
025 public static File convert(
026 String id, InputStream inputStream, String sourceExtension,
027 String targetExtension)
028 throws Exception {
029
030 Object returnObj = PortalClassInvoker.invoke(
031 false, _convertMethodKey, id, inputStream, sourceExtension,
032 targetExtension);
033
034 if (returnObj != null) {
035 return (File)returnObj;
036 }
037 else {
038 return null;
039 }
040 }
041
042 public static String[] getConversions(String extension) throws Exception {
043 Object returnObj = PortalClassInvoker.invoke(
044 false, _getConversionsMethodKey, extension);
045
046 if (returnObj != null) {
047 return (String[])returnObj;
048 }
049 else {
050 return null;
051 }
052 }
053
054 private static final String _CLASS_NAME =
055 "com.liferay.portlet.documentlibrary.util.DocumentConversionUtil";
056
057 private static MethodKey _convertMethodKey = new MethodKey(
058 ClassResolverUtil.resolveByPortalClassLoader(_CLASS_NAME), "convert",
059 String.class, InputStream.class, String.class, String.class);
060 private static MethodKey _getConversionsMethodKey = new MethodKey(
061 ClassResolverUtil.resolveByPortalClassLoader(_CLASS_NAME),
062 "getConversions", String.class);
063
064 }