I tried to convert vsd to vsdx in parallel processing.
However, if in parallel processing, any converted file cannot be open by the visio.
※ when open that with the visio, it displays a error message.
※ 133.vsd.vsdx and 135.vsd.vsdx in sample datas that are attached this topic cannot be open.
In sequential processing, all files are converted into vsdx files these can be opened by the visio.
Is it possible to convert normally even in parallel processing?
public void sample() throws Exception { Path input = Paths.get("C:\\test\\input"); Path output = Paths.get("C:\\test\\output"); List<String> fileNames = Arrays.asList("133.vsd", "134.vsd", "135.vsd", "136.vsd", "144.vsd"); fileNames.stream() .parallel() .forEach(x -> { try (InputStream stream = Files.newInputStream(input.resolve(x)); OutputStream outputStream = Files.newOutputStream(output.resolve(x + ".vsdx"))) { Diagram diagram = new Diagram(stream); diagram.save(outputStream, SaveFileFormat.VSDX); } catch (Exception e) { System.out.println(x + ": converting failed."); } }); }
Using version:Aspose.Diagram for Java 22.4
sample data:sample.zip (1.4 MB)