OpenOffice.org
XMerge API

org.openoffice.xmerge
Class Convert

java.lang.Object
  |
  +--org.openoffice.xmerge.Convert
All Implemented Interfaces:
java.lang.Cloneable

public class Convert
extends java.lang.Object
implements java.lang.Cloneable

The Convert class manages a conversion from one mime-type to another. The ConvertFactory is responsible for returning the appropriate Convert class for a specified conversion. This class is responsible for all interactions with the PluginFactory implementation.

See Also:
ConverterFactory, PluginFactory, ConverterInfo

Constructor Summary
Convert(ConverterInfo ci, boolean toOffice)
          Construct a Convert class with specified ConvertInfo registry information.
 
Method Summary
 void addInputStream(java.lang.String name, java.io.InputStream is)
          Adds an InputStream to be used as input by the Convert class.
 void addInputStream(java.lang.String name, java.io.InputStream is, boolean isZip)
          Adds an InputStream to be used as input by the Convert class.
 java.lang.Object clone()
          Clones a Convert object so another Convert object can do the same conversion.
 ConvertData convert()
          Convert the input specified in calls to the addInputStream method to the output format specified by this Convert class.
 Document getDeviceDocument(java.lang.String name, java.io.InputStream is)
          Returns the appropriate "Device" Document object for this plug-in.
 DocumentMerger getDocumentMerger(Document origDoc)
          Adds the original Document to the Convert Class.
 Document getOfficeDocument(java.lang.String name, java.io.InputStream is)
          Returns the appropriate "Office" Document object for this plug-in.
 void reset()
          Resets the input queue, so that the user can use this class to perform another conversion.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Convert

public Convert(ConverterInfo ci,
               boolean toOffice)
Construct a Convert class with specified ConvertInfo registry information.
Parameters:
ci - A ConvertInfo object containing registry information corresponding to a specific plug-in.
toOffice - true if converting to the Office format, false if converting to the device format.
Method Detail

addInputStream

public void addInputStream(java.lang.String name,
                           java.io.InputStream is)
                    throws java.io.IOException
Adds an InputStream to be used as input by the Convert class. It is possible that many files need to be converted into a single output Documetn, so this function may be called more than one time. It is the plug-in's responsibility to know how to handle the input.
Parameters:
name - The name corresponding to the InputStream.
is - InputStream to be used as input.
Throws:
java.io.IOException - If any I/O error occurs.

addInputStream

public void addInputStream(java.lang.String name,
                           java.io.InputStream is,
                           boolean isZip)
                    throws java.io.IOException
Adds an InputStream to be used as input by the Convert class. It is possible that many files need to be converted into a single output Documetn, so this function may be called more than one time. It is the plug-in's responsibility to know how to handle the input.
Parameters:
name - The name corresponding to the InputStream.
is - InputStream to be used as input.
isZip - boolean to identify that incoming stream is * zipped
Throws:
java.io.IOException - If any I/O error occurs.

clone

public java.lang.Object clone()
Clones a Convert object so another Convert object can do the same conversion. InputStream objects passed in via calls to the addInputStream method are not copied.
Overrides:
clone in class java.lang.Object
Returns:
The cloned Convert object.

convert

public ConvertData convert()
                    throws ConvertException,
                           java.io.IOException
Convert the input specified in calls to the addInputStream method to the output format specified by this Convert class.
Returns:
The output data.
Throws:
ConvertException - If any conversion error occurs.
java.io.IOException - If any I/O error occurs.

getDeviceDocument

public Document getDeviceDocument(java.lang.String name,
                                  java.io.InputStream is)
                           throws java.io.IOException
Returns the appropriate "Device" Document object for this plug-in.
Parameters:
name - The name of the Document to create.
is - The InputStream corresponding to the Document to create.
Returns:
The appropriate "Device" Document object for this plug-in.
Throws:
java.io.IOException - If any I/O error occurs.

getDocumentMerger

public DocumentMerger getDocumentMerger(Document origDoc)
                                 throws java.io.IOException
Adds the original Document to the Convert Class. This is to be used for merges. If this Document is added then it is assumed that a convert with merge is the desired operation.
Parameters:
name - The Document name.
is - InputStream object corresponding to the Document.
Throws:
java.io.IOException - If any I/O error occurs.

getOfficeDocument

public Document getOfficeDocument(java.lang.String name,
                                  java.io.InputStream is)
                           throws java.io.IOException
Returns the appropriate "Office" Document object for this plug-in.
Parameters:
name - The name of the Document to create.
is - The InputStream corresponding to the Document to create.
Returns:
The appropriate "Office" Document object for this plug-in.
Throws:
java.io.IOException - If any I/O error occurs.

reset

public void reset()
Resets the input queue, so that the user can use this class to perform another conversion. This causes the addInputStream method to accept input for the next conversion.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org