com.silverpeas.converter
Interface DocumentFormatConversion

All Known Subinterfaces:
HTMLConverter, ODTConverter, ToHTMLConverter, ToPDFConverter
All Known Implementing Classes:
OpenOfficeConverter, OpenOfficeHTMLConverter, OpenOfficeODTConverter, OpenOfficeToHTMLConverter, OpenOfficeToPDFConverter

public interface DocumentFormatConversion

This interface defines the ability to convert a document in a given format into a specified another format. An object with a such property should implement this interface. A converter takes into account a specific format of documents and provides the capability to convert it into another format. It can support only a subset of available conversions in Silverpeas.


Method Summary
 File convert(File source, DocumentFormat inFormat, FilterOption... options)
          Converts the specified document in the specified format.
 File convert(File source, File destination, DocumentFormat inFormat, FilterOption... options)
          Converts the specified document in the specified format.
 void convert(InputStream source, DocumentFormat inFormat, OutputStream destination, DocumentFormat outFormat, FilterOption... options)
          Converts the specified inputstream/format in the specified outputstream/format.
 DocumentFormat[] getSupportedFormats()
          Gets the formats of documents supported by the converter.
 

Method Detail

convert

File convert(File source,
             DocumentFormat inFormat,
             FilterOption... options)
Converts the specified document in the specified format. The format should be supported by the converter. If an error occurs while converting the specified file, then a runtime exception DocumentFormatConversionException is thrown.

Parameters:
source - the document to convert.
inFormat - the format into which the document has to be converted.
options - additional options such as "PageRange"
Returns:
the file with the converted document.

convert

File convert(File source,
             File destination,
             DocumentFormat inFormat,
             FilterOption... options)
Converts the specified document in the specified format. The format should be supported by the converter. If an error occurs while converting the specified file, then a runtime exception DocumentFormatConversionException is thrown.

Parameters:
source - the document to convert.
destination - the converted document.
inFormat - the format into which the document has to be converted.
Returns:
the destination file.

convert

void convert(InputStream source,
             DocumentFormat inFormat,
             OutputStream destination,
             DocumentFormat outFormat,
             FilterOption... options)
Converts the specified inputstream/format in the specified outputstream/format.

Parameters:
source - the source stream to convert.
inFormat - the format from which the document has to be converted.
destination - the converted stream.
outFormat - the format into which the document has to be converted.

getSupportedFormats

DocumentFormat[] getSupportedFormats()
Gets the formats of documents supported by the converter.

Returns:
an array with the different formats into which the object implementing this interface can convert a document.


Copyright © 2016 Silverpeas. All Rights Reserved.