Interface OfficeConverter


  • public interface OfficeConverter
    Interface used to convert documents between various office formats.
    Since:
    5.0M2
    Version:
    $Id: 4bfada42506d056b2816fbdb8281535125ac8785 $
    • Method Detail

      • convertDocument

        @Unstable
        default OfficeConverterResult convertDocument​(Map<String,​InputStream> inputStreams,
                                                      String inputFileName,
                                                      String outputFileName)
                                               throws OfficeConverterException
        Attempts to convert the input document identified by inputStreams and inputFileName arguments into the format identified by outputFileName argument. Note that this method does not perform a cleanup of the generated files so they can be read in the further steps. Don't forget to call Closeable.close() to not keep remaining files.
        Parameters:
        inputStreams - input streams corresponding to the input document; it's possible that some document types (e.g. HTML) consists of more than one input stream corresponding to different artifacts embedded within document content
        inputFileName - name of the main input file within inputStreams map; this argument is used to determine the format of the input document
        outputFileName - name of the main output file; an entry corresponding to this name will be available in the results map if the conversion succeeds; This argument is used to determine the format of the output document
        Returns:
        a result containing the paths of the files created during the conversion.
        Throws:
        OfficeConverterException - if an error occurs during the conversion
        Since:
        13.1RC1
      • isPresentation

        @Unstable
        default boolean isPresentation​(String officeFileName)
        Parameters:
        officeFileName - the office file name to recognize
        Returns:
        true if the file name / extension represents an office presentation format
        Since:
        13.1RC1
      • getDocumentFormat

        @Unstable
        default OfficeDocumentFormat getDocumentFormat​(String officeFileName)
        Retrieve the office document format based on the given file name.
        Parameters:
        officeFileName - the name of an office document.
        Returns:
        the office document format associated with the given file extension.
        Since:
        13.1RC1
      • isMediaTypeSupported

        @Unstable
        default boolean isMediaTypeSupported​(String mediaType)
        Checks if the office documents with the specified media type can be converted by this converter.
        Parameters:
        mediaType - a media type
        Returns:
        true if the specified media type is supported, false otherwise
        Since:
        13.1RC1
      • isConversionSupported

        @Unstable
        default boolean isConversionSupported​(String inputMediaType,
                                              String outputMediaType)
        Use this method to check if the unidirectional conversion from a document format (input media type) to another document format (output media type) is supported by this converter.
        Parameters:
        inputMediaType - the media type of the input document
        outputMediaType - the media type of the output document
        Returns:
        true if a document can be converted from the input media type to the output media type, false otherwise
        Since:
        13.1RC1