19package org.openoffice.xmerge.util;
22import java.io.FileOutputStream;
23import java.io.FileInputStream;
24import java.io.IOException;
26import java.util.StringTokenizer;
27import java.util.NoSuchElementException;
38 public static void main(String[] args) {
39 if (
args.length != 4) {
54 private boolean Convert(String srcMime, String dstMime, String srcFile,
63 String strClassPath =
System.getProperty(
"java.class.path");
65 StringTokenizer st =
new StringTokenizer(strClassPath,
";");
68 while (st.hasMoreTokens()) {
71 if (s.endsWith(
"xmerge.jar")) {
72 ooClassDir = s.substring(0, s.indexOf(
"xmerge.jar"));
76 if (ooClassDir ==
null) {
88 if (srcMime.equals(
"staroffice/sxw") || srcMime.equals(
"application/x-pocket-word")) {
89 pluginJar =
new File(ooClassDir +
"pocketWord.jar");
91 if (srcMime.equals(
"staroffice/sxc") || srcMime.equals(
"application/x-pocket-excel")) {
92 pluginJar =
new File(ooClassDir +
"pexcel.jar");
111 FileInputStream fis =
null;
112 FileOutputStream fos =
null;
114 fis =
new FileInputStream(srcFile);
117 fos =
new FileOutputStream(dstFile);
ConvertData is used as a container for passing Document objects in and out of the Convert class.
Iterator< Object > getDocumentEnumeration()
Gets an Enumeration to access the Vector of Document objects.
This Exception is thrown by convert algorithms.
The Convert class manages a conversion from one mime-type to another.
void addInputStream(String name, InputStream is)
Adds an InputStream to be used as input by the Convert class.
ConvertData convert()
Convert the input specified in calls to the addInputStream method to the output format specified by t...
Factory that provides access to Convert objects, which are used to do a conversion.
Convert getConverter(String mimeTypeIn, String mimeTypeOut)
Returns the Convert object that converts the specified device/office mime type conversion.
boolean Convert(String srcMime, String dstMime, String srcFile, String dstFile)
static void main(String[] args)
Manages the converter plug-ins that are currently active.
static void addPlugIn(ConverterInfo ci)
Adds a converter plug-in to the registry.
The ConverterInfoReader pulls a META-INF/converter.xml file out of a jar file and parses it,...
Iterator< ConverterInfo > getConverterInfoEnumeration()
Returns an Enumeration of ConverterInfo objects.
A Document represents any Document to be converted and the resulting Document from any conversion.
void write(OutputStream os)
Writes out the Document content to the specified OutputStream.
Provides an interface for plug-in registration.
Provides general purpose utilities.
Provides interfaces for converting between two Document formats, and supports a "merge" interface for...