Package writer2latex.api
Interface Converter
-
- All Known Implementing Classes:
Converter,Converter,ConverterBase,ConverterPalette,EPUBConverter,Html5Converter,Xhtml10Converter,Xhtml11Converter,XhtmlMathMLConverter
public interface ConverterThis is an interface for a converter, which offers conversion of OpenDocument (or OpenOffice.org 1.x) documents into a specific format. Instances of this interface are created using theConverterFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ConverterResultconvert(java.io.File source, java.lang.String sTargetFileName)Convert a documentConverterResultconvert(java.io.InputStream is, java.lang.String sTargetFileName)Convert a documentConverterResultconvert(org.w3c.dom.Document dom, java.lang.String sTargetFileName, boolean bDestructive)Convert a documentConfiggetConfig()Get the interface for the configuration of this convertervoidreadResource(java.io.File file, java.lang.String sFileName, java.lang.String sMediaType)Read a style sheet to include with the converted document.voidreadResource(java.io.InputStream is, java.lang.String sFileName, java.lang.String sMediaType)Read a resource to include with the converted document.voidreadStyleSheet(java.io.File file)Read a style sheet to include with the converted document.voidreadStyleSheet(java.io.InputStream is)Read a style sheet to include with the converted document.voidreadTemplate(java.io.File file)Read a template to use as a base for the converted document.voidreadTemplate(java.io.InputStream is)Read a template to use as a base for the converted document.voidsetGraphicConverter(GraphicConverter gc)Define aGraphicConverterimplementation to use for conversion of graphic files.
-
-
-
Method Detail
-
getConfig
Config getConfig()
Get the interface for the configuration of this converter- Returns:
- the configuration
-
setGraphicConverter
void setGraphicConverter(GraphicConverter gc)
Define aGraphicConverterimplementation to use for conversion of graphic files. If no converter is specified, graphic files will not be converted into other formats.- Parameters:
gc- theGraphicConverterto use
-
readTemplate
void readTemplate(java.io.InputStream is) throws java.io.IOExceptionRead a template to use as a base for the converted document. The format of the template depends on theConverterimplementation.- Parameters:
is- anInputStreamfrom which to read the template- Throws:
java.io.IOException- if some exception occurs while reading the template
-
readTemplate
void readTemplate(java.io.File file) throws java.io.IOExceptionRead a template to use as a base for the converted document. The format of the template depends on theConverterimplementation.- Parameters:
file- a file from which to read the template- Throws:
java.io.IOException- if the file does not exist or some exception occurs while reading the template
-
readStyleSheet
void readStyleSheet(java.io.InputStream is) throws java.io.IOExceptionRead a style sheet to include with the converted document. The format of the style sheet depends on theConverterimplementation.- Parameters:
is- anInputStreamfrom which to read the style sheet- Throws:
java.io.IOException- if some exception occurs while reading the style sheet
-
readStyleSheet
void readStyleSheet(java.io.File file) throws java.io.IOExceptionRead a style sheet to include with the converted document. The format of the style sheet depends on theConverterimplementation.- Parameters:
file- a file from which to read the style sheet- Throws:
java.io.IOException- if the file does not exist or some exception occurs while reading the style sheet
-
readResource
void readResource(java.io.InputStream is, java.lang.String sFileName, java.lang.String sMediaType) throws java.io.IOExceptionRead a resource to include with the converted document. A resource can be any (binary) file and will be placed in the same directory as the style sheet- Parameters:
is- anInputStreamfrom which to read the resourcesFileName- the file name to use for the resourcesMediaType- the media type of the resource, if null the media type will be guessed from the file name- Throws:
java.io.IOException- if some exception occurs while reading the resource
-
readResource
void readResource(java.io.File file, java.lang.String sFileName, java.lang.String sMediaType) throws java.io.IOExceptionRead a style sheet to include with the converted document. A resource can be any (binary) file and will be placed in the same directory as the style sheet- Parameters:
file- a file from which to read the style sheetsFileName- the file name to use for the resourcesMediaType- the media type of the resource, if null the media type will be guessed from the file name- Throws:
java.io.IOException- if the file does not exist or some exception occurs while reading the resource
-
convert
ConverterResult convert(java.io.InputStream is, java.lang.String sTargetFileName) throws java.io.IOException
Convert a document- Parameters:
is- anInputStreamfrom which to read the source document.sTargetFileName- the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)- Returns:
- a
ConverterResultcontaining the converted document - Throws:
java.io.IOException- if some exception occurs while reading the document
-
convert
ConverterResult convert(java.io.File source, java.lang.String sTargetFileName) throws java.io.FileNotFoundException, java.io.IOException
Convert a document- Parameters:
source- aFilefrom which to read the source document.sTargetFileName- the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)- Returns:
- a
ConverterResultcontaining the converted document - Throws:
java.io.FileNotFoundException- if the file does not existjava.io.IOException- if some exception occurs while reading the document
-
convert
ConverterResult convert(org.w3c.dom.Document dom, java.lang.String sTargetFileName, boolean bDestructive) throws java.io.IOException
Convert a document- Parameters:
dom- a DOM tree representing the document as flat XMLsTargetFileName- the file name to use for the converted document (if the converted document is a compound document consisting consisting of several files, this name will be used for the master document)bDestructive- set to true if the converter is allowed to remove contents from the DOM tree (to save memory)- Returns:
- a
ConverterResultcontaining the converted document - Throws:
java.io.IOException- if some exception occurs while reading the document
-
-