try {
//Check to see if jar contains a plugin Impl
ConverterInfoMgr.addPlugIn(ciEnum);
ConverterFactory cf = new ConverterFactory();
Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),false);
if (cv == null) {
System.out.println("\nNo plug-in exists to convert from <staroffice/sxw> to <specified format> ");
}
else
{
cv.addInputStream(name,(InputStream)xis,false);
ConvertData dataOut = cv.convert();
Enumeration docEnum = dataOut.getDocumentEnumeration();
if (docEnum.hasMoreElements()){
Document docOut = (Document)docEnum.nextElement();
String fileName = docOut.getFileName();
docOut.write(newxos);
newxos.flush();
newxos.close();
int i=1;
while (docEnum.hasMoreElements() && sURL.startsWith("file:")) {
//URI uri=new URI(sFileName);
URI uri=new URI(sURL);
String newFileName= getPath(uri);
//System.out.println("\nURI: "+uri.getPath());
File newFile=null;
if (newFileName.lastIndexOf(".")!=-1){
newFile =new File(newFileName.substring(0,newFileName.lastIndexOf("."))+String.valueOf(i)+newFileName.substring(newFileName.lastIndexOf(".")));
}
else{
newFile =new File(newFileName.concat(String.valueOf(i)));
}
FileOutputStream fos = new FileOutputStream(newFile);
docOut = (Document)docEnum.nextElement();
fileName = docOut.getFileName();
docOut.write(fos);
fos.flush();
fos.close();
i++;
}
}
}
ConverterInfoMgr.removeByJar(jarName);
}
catch (StackOverflowError sOE){
System.out.println("\nERROR : Stack OverFlow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n");
}
catch (Exception e) {
System.out.println("Error:"+e);
throw new IOException("Xmerge Exception");
}
}
else{
try {
//Check to see if jar contains a plugin Impl
ConverterInfoMgr.addPlugIn(ciEnum);
ConverterFactory cf = new ConverterFactory();
Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),true);
if (cv == null) {
System.out.println("\nNo plug-in exists to convert to <staroffice/sxw> from <specified format>");
}
else
{