public class DocumentConverterService extends Object implements org.springframework.context.ApplicationContextAware
| Modifier and Type | Field and Description |
|---|---|
protected static Map<String,Object> |
DEF_PROPS |
| Constructor and Description |
|---|
DocumentConverterService() |
| Modifier and Type | Method and Description |
|---|---|
void |
convert(File inputFile,
org.artofsolving.jodconverter.document.DocumentFormat inputFormat,
File outputFile,
org.artofsolving.jodconverter.document.DocumentFormat outputFormat)
Converts the provided input file into output, considering provided
document formats.
|
void |
convert(File inputFile,
File outputFile)
Converts the provided input file into output automatically detecting file
mime-type by is extension.
|
File |
convert(File inputFile,
String inputFileMimeType,
String outputMimeType)
Converts the provided file, considering provided mime-types.
|
void |
convert(InputStream inputStream,
String inputMimeType,
OutputStream outputStream,
String outputMimeType)
Converts the provided input stream into output, considering provided
mime-types.
|
protected File |
createTempFile() |
protected org.artofsolving.jodconverter.office.OfficeTask |
getConversionTask(File inputFile,
org.artofsolving.jodconverter.document.DocumentFormat inputFormat,
File outputFile,
org.artofsolving.jodconverter.document.DocumentFormat outputFormat)
Converts the provided input file into output, considering provided
document formats.
|
String |
getExtension(String mimeType) |
org.artofsolving.jodconverter.document.DocumentFormat |
getFormat(File file)
Returns the
DocumentFormat based of the extension of the
specified file. |
org.artofsolving.jodconverter.document.DocumentFormat |
getFormatByFileName(String fileName)
Returns the
DocumentFormat based on the extension extracted from the file name of the
specified file. |
org.artofsolving.jodconverter.document.DocumentFormat |
getFormatByMimeType(String mimeType)
Returns the
DocumentFormat based on the mimeType of the
specified file. |
String |
getMimeType(String extension) |
boolean |
isEnabled() |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setDefaultLoadProperties(Map<String,?> defaultLoadProperties) |
void |
setEnabled(boolean enabled) |
void |
setFormatRegistry(org.artofsolving.jodconverter.document.DocumentFormatRegistry formatRegistry)
Initializes an instance of the document format registry.
|
void |
setOfficeManagerBeanName(String officeManagerBeanName) |
void |
start()
Initializes the service and starts office manager.
|
void |
stop()
Shuts down the office manager.
|
protected void |
writeToOutputStream(OutputStream os,
File file) |
public void convert(File inputFile, org.artofsolving.jodconverter.document.DocumentFormat inputFormat, File outputFile, org.artofsolving.jodconverter.document.DocumentFormat outputFormat) throws org.artofsolving.jodconverter.office.OfficeException
inputFile - the source fileinputFormat - description of the source fileoutputFile - the output file descriptor to store converted content
intooutputFormat - description of the output fileorg.artofsolving.jodconverter.office.OfficeException - in case of a conversion errorpublic void convert(File inputFile, File outputFile) throws org.artofsolving.jodconverter.office.OfficeException
inputFile - the source fileoutputFile - the output file descriptor to store converted content
intoorg.artofsolving.jodconverter.office.OfficeException - in case of a conversion errorpublic void convert(InputStream inputStream, String inputMimeType, OutputStream outputStream, String outputMimeType) throws org.artofsolving.jodconverter.office.OfficeException
inputStream - the source streaminputMimeType - the input MIME typeoutputStream - the destination streamoutputMimeType - the output MIME typeorg.artofsolving.jodconverter.office.OfficeException - in case of a conversion errorpublic File convert(File inputFile, String inputFileMimeType, String outputMimeType) throws IOException, org.artofsolving.jodconverter.office.OfficeException
inputFile - the source FileinputFileMimeType - the source file content typeoutputMimeType - the output MIME typeorg.artofsolving.jodconverter.office.OfficeException - in case of a conversion errorIOExceptionprotected File createTempFile() throws IOException
IOExceptionprotected void writeToOutputStream(OutputStream os, File file)
os - The outputStream to write intofile - The file to read fromprotected org.artofsolving.jodconverter.office.OfficeTask getConversionTask(File inputFile, org.artofsolving.jodconverter.document.DocumentFormat inputFormat, File outputFile, org.artofsolving.jodconverter.document.DocumentFormat outputFormat)
inputFile - the source fileinputFormat - description of the source fileoutputFile - the output file descriptor to store converted content
intooutputFormat - description of the output filepublic org.artofsolving.jodconverter.document.DocumentFormat getFormat(File file)
DocumentFormat based of the extension of the
specified file.file - the file to detect format forDocumentFormat based of the extension of the
specified filepublic org.artofsolving.jodconverter.document.DocumentFormat getFormatByMimeType(String mimeType)
DocumentFormat based on the mimeType of the
specified file.mimeType - the mimeType to detect format forDocumentFormat based on a mimeTypepublic org.artofsolving.jodconverter.document.DocumentFormat getFormatByFileName(String fileName)
DocumentFormat based on the extension extracted from the file name of the
specified file.fileName - the file name to detect format forDocumentFormat based on a mimeTypepublic boolean isEnabled()
public void setDefaultLoadProperties(Map<String,?> defaultLoadProperties)
defaultLoadProperties - the defaultLoadProperties to setpublic void setEnabled(boolean enabled)
enabled - the enabled to setpublic void setFormatRegistry(org.artofsolving.jodconverter.document.DocumentFormatRegistry formatRegistry)
formatRegistry - an instance of the document format registrypublic void start()
throws org.artofsolving.jodconverter.office.OfficeException
org.artofsolving.jodconverter.office.OfficeException - in case of an initialization errorpublic void stop()
throws org.artofsolving.jodconverter.office.OfficeException
org.artofsolving.jodconverter.office.OfficeException - in case of a shutdown errorpublic void setOfficeManagerBeanName(String officeManagerBeanName)
officeManagerBeanName - the officeManagerBeanName to setpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.