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++;
}