1 | package pro.verron.officestamper.preset; | |
2 | ||
3 | import org.docx4j.openpackaging.exceptions.Docx4JException; | |
4 | import org.docx4j.openpackaging.packages.PresentationMLPackage; | |
5 | import org.docx4j.openpackaging.packages.SpreadsheetMLPackage; | |
6 | import pro.verron.officestamper.api.OfficeStamper; | |
7 | import pro.verron.officestamper.api.OfficeStamperException; | |
8 | import pro.verron.officestamper.api.StreamStamper; | |
9 | import pro.verron.officestamper.experimental.ExcelStamper; | |
10 | import pro.verron.officestamper.experimental.PowerpointStamper; | |
11 | ||
12 | import java.io.InputStream; | |
13 | ||
14 | /// ExperimentalStampers is a class that provides static methods for obtaining instances of OfficeStamper | |
15 | /// implementations for stamping PowerPoint presentations and Excel templates with context and writing | |
16 | /// the result to an OutputStream. | |
17 | /// | |
18 | /// @since 1.6.8 | |
19 | public class ExperimentalStampers { | |
20 | ||
21 | private ExperimentalStampers() { | |
22 | throw new OfficeStamperException("ExperimentalStampers cannot be instantiated"); | |
23 | } | |
24 | ||
25 | /// Returns a new instance of the OfficeStamper implementation | |
26 | /// for stamping PowerPoint presentations with context and writing | |
27 | /// the result to an OutputStream. | |
28 | /// | |
29 | /// @return a new OfficeStamper instance for PowerPoint presentations | |
30 | /// | |
31 | /// @since 1.6.8 | |
32 | public static StreamStamper<PresentationMLPackage> pptxStamper() { | |
33 | var stamper = new PowerpointStamper(); | |
34 |
1
1. pptxStamper : replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::pptxStamper → KILLED |
return new StreamStamper<>(ExperimentalStampers::loadPowerPoint, stamper); |
35 | } | |
36 | ||
37 | private static PresentationMLPackage loadPowerPoint(InputStream inputStream) { | |
38 | try { | |
39 |
1
1. loadPowerPoint : replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::loadPowerPoint → KILLED |
return PresentationMLPackage.load(inputStream); |
40 | } catch (Docx4JException e) { | |
41 | throw new OfficeStamperException(e); | |
42 | } | |
43 | } | |
44 | ||
45 | /// Returns a new instance of the OfficeStamper implementation | |
46 | /// for stamping Excel templates with context and writing the result to an OutputStream. | |
47 | /// | |
48 | /// @return a new OfficeStamper instance for Excel templates | |
49 | /// | |
50 | /// @since 1.6.8 | |
51 | public static OfficeStamper<SpreadsheetMLPackage> xlsxStamper() { | |
52 |
1
1. xlsxStamper : replaced return value with null for pro/verron/officestamper/preset/ExperimentalStampers::xlsxStamper → KILLED |
return new ExcelStamper(); |
53 | } | |
54 | } | |
Mutations | ||
34 |
1.1 |
|
39 |
1.1 |
|
52 |
1.1 |