Docmosis API 4.5.0

com.docmosis.document.converter
Class ConversionFormat

java.lang.Object
  extended bycom.docmosis.document.converter.ConversionFormat
All Implemented Interfaces:
Serializable

public class ConversionFormat
extends Object
implements Serializable

This class specifies the available target formats for document production. A ConversionInstruction instance will specify the format(s) it would like the final document(s) rendered in. The available formats are public constants.

See Also:
ConversionInstruction, Serialized Form

Field Summary
static ConversionFormat FORMAT_CSV
           
static ConversionFormat FORMAT_DOCX
          Specify DOCX as the format
static ConversionFormat FORMAT_FODT
          Specify FODT (Flat Open Document Text) as the format
static ConversionFormat FORMAT_HTML
          Specify HTML as the format.
static ConversionFormat FORMAT_JPG
           
static ConversionFormat FORMAT_ODG
           
static ConversionFormat FORMAT_ODP
           
static ConversionFormat FORMAT_ODS
           
static ConversionFormat FORMAT_ODT
          Specify ODT (Open Document Text) as the format
static ConversionFormat FORMAT_PDF
          Specify PDF as the format
static ConversionFormat FORMAT_PNG
           
static ConversionFormat FORMAT_PPT
           
static ConversionFormat FORMAT_RTF
          Specify RTF (Rich Text Format) as the format
static ConversionFormat FORMAT_TEXT
          Specify TEXT as the format
static ConversionFormat FORMAT_WORD
          Specify Word as the format
static ConversionFormat FORMAT_WORD_XML
          Specify Word XML as the format
static ConversionFormat FORMAT_XHTML
          Specify XHTML as the format
static ConversionFormat FORMAT_XLS
           
static ConversionFormat FORMAT_XLSX
           
 
Method Summary
 boolean equals(Object other)
           
static boolean fileNameMatchesFormat(String fileName, ConversionFormat format)
          Determine if the given file name matches the given format.
 String getAlternateExtension()
          Get the alternate file extension of this format if any.
 String getExtension()
          Get the typical file extension of this format.
static ConversionFormat getFormat(String extn)
          Get the format matching the given extension (eg "pdf") in a case-insensitive manner.
static ConversionFormat[] getFormatArray(String extns)
          Get the formats matching the given comma separated list of extensions (eg "pdf,doc") in a case-insensitive manner.
static ConversionFormat getFormatForFileName(String fileName)
          Get the format matching the given file name (by using the extension in a case-insensitive manner).
 String getFormatName()
          Get the name of this format.
static boolean hasCorrectExtension(String name, ConversionFormat format)
          Determine if the given file name has the correct extension for the given format.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FORMAT_PDF

public static final ConversionFormat FORMAT_PDF
Specify PDF as the format


FORMAT_WORD

public static final ConversionFormat FORMAT_WORD
Specify Word as the format


FORMAT_WORD_XML

public static final ConversionFormat FORMAT_WORD_XML
Specify Word XML as the format


FORMAT_DOCX

public static final ConversionFormat FORMAT_DOCX
Specify DOCX as the format


FORMAT_ODT

public static final ConversionFormat FORMAT_ODT
Specify ODT (Open Document Text) as the format


FORMAT_FODT

public static final ConversionFormat FORMAT_FODT
Specify FODT (Flat Open Document Text) as the format


FORMAT_RTF

public static final ConversionFormat FORMAT_RTF
Specify RTF (Rich Text Format) as the format


FORMAT_HTML

public static final ConversionFormat FORMAT_HTML
Specify HTML as the format. Note if the rendered document contains images these need to be delivered as well, so make make sure you expect a zip file to be produced. You can expect a zip file if you choose multiple ConversionFormats, or you set compressSingleDocument flag (see ConversionInstruction.setCompressingSingleDocument(boolean))


FORMAT_XHTML

public static final ConversionFormat FORMAT_XHTML
Specify XHTML as the format


FORMAT_TEXT

public static final ConversionFormat FORMAT_TEXT
Specify TEXT as the format


FORMAT_XLS

public static final ConversionFormat FORMAT_XLS

FORMAT_XLSX

public static final ConversionFormat FORMAT_XLSX

FORMAT_PPT

public static final ConversionFormat FORMAT_PPT

FORMAT_ODG

public static final ConversionFormat FORMAT_ODG

FORMAT_ODS

public static final ConversionFormat FORMAT_ODS

FORMAT_ODP

public static final ConversionFormat FORMAT_ODP

FORMAT_PNG

public static final ConversionFormat FORMAT_PNG

FORMAT_JPG

public static final ConversionFormat FORMAT_JPG

FORMAT_CSV

public static final ConversionFormat FORMAT_CSV
Method Detail

getFormatName

public String getFormatName()
Get the name of this format.

Returns:
a textual representation of the name of this format

getFormatForFileName

public static ConversionFormat getFormatForFileName(String fileName)
Get the format matching the given file name (by using the extension in a case-insensitive manner). Note, file names with following extensions are mapped as indicated in addition to the standard mapping:
  "odf"  - FORMAT_ODT 
  "htm"  - FORMAT_HTML 
  "text" - FORMAT_TEXT
 

Parameters:
fileName - the name of the file upon which the format will be based
Returns:
null if the filename does not correlate with a known format.

getFormat

public static ConversionFormat getFormat(String extn)
Get the format matching the given extension (eg "pdf") in a case-insensitive manner. Note, the following extensions are mapped as indicated in addition to the standard mapping:
  "odf"  - FORMAT_ODT 
  "htm"  - FORMAT_HTML 
  "text" - FORMAT_TEXT
 

Parameters:
extn - the extension to lookup (usually a file-name suffix).
Returns:
null if the extension does not correlate with a known format.

getFormatArray

public static ConversionFormat[] getFormatArray(String extns)
Get the formats matching the given comma separated list of extensions (eg "pdf,doc") in a case-insensitive manner. If any extension is not recognised, a null is placed at that location in the resulting array. White-space in the comma separated string is allowed.

Parameters:
extns - the comma separated list of extensions
Returns:
an array of ConversionFormat[] objects possibly containing nulls or null if the given extns is null or empty

hasCorrectExtension

public static boolean hasCorrectExtension(String name,
                                          ConversionFormat format)
Determine if the given file name has the correct extension for the given format. The test is case-insensitive.

Parameters:
name - the file name to test
format - the format to test
Returns:
true if they match.

getExtension

public String getExtension()
Get the typical file extension of this format.

Returns:
a textual representation of the file extension of this format including the leading "."

getAlternateExtension

public String getAlternateExtension()
Get the alternate file extension of this format if any.

Returns:
a textual representation of the file extension of this format including the leading "." or null if there is none.

fileNameMatchesFormat

public static boolean fileNameMatchesFormat(String fileName,
                                            ConversionFormat format)
Determine if the given file name matches the given format. This is done by checking for an extension on the file name that matches the format's extension or alternate extension. The test is case-insensitive.

Parameters:
fileName - the file name to test
format - the format to compare with
Returns:
true if there is a match.

hashCode

public int hashCode()

equals

public boolean equals(Object other)

toString

public String toString()

Docmosis API 4.5.0

Copyright © 2014 Docmosis Pty Ltd. All Rights Reserved.