diff options
Diffstat (limited to 'poi-examples')
3 files changed, 5 insertions, 5 deletions
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/hssf/usermodel/OfficeDrawing.java b/poi-examples/src/main/java/org/apache/poi/examples/hssf/usermodel/OfficeDrawing.java index 2cefd3d87f..c3a5b8c400 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/hssf/usermodel/OfficeDrawing.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/hssf/usermodel/OfficeDrawing.java @@ -192,7 +192,7 @@ public final class OfficeDrawing { private static int loadPicture( String path, HSSFWorkbook wb ) throws IOException { int pictureIndex; try (FileInputStream fis = new FileInputStream(path); - UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()) { + UnsynchronizedByteArrayOutputStream bos = UnsynchronizedByteArrayOutputStream.builder().get()) { IOUtils.copy(fis, bos); pictureIndex = wb.addPicture(bos.toByteArray(), Workbook.PICTURE_TYPE_PNG); } diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/CustomXMLMapping.java b/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/CustomXMLMapping.java index edba46bba3..e1a912e734 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/CustomXMLMapping.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/xssf/usermodel/CustomXMLMapping.java @@ -38,7 +38,7 @@ public final class CustomXMLMapping { for (XSSFMap map : wb.getCustomXMLMappings()) { XSSFExportToXml exporter = new XSSFExportToXml(map); - UnsynchronizedByteArrayOutputStream os = new UnsynchronizedByteArrayOutputStream(); + UnsynchronizedByteArrayOutputStream os = UnsynchronizedByteArrayOutputStream.builder().get(); exporter.exportToXML(os, true); String xml = os.toString(StandardCharsets.UTF_8); System.out.println(xml); diff --git a/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java b/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java index a9bed39008..b172b38295 100644 --- a/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java +++ b/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java @@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test; public class TestXLSX2CSV { private PrintStream err; - private final UnsynchronizedByteArrayOutputStream errorBytes = new UnsynchronizedByteArrayOutputStream(); + private final UnsynchronizedByteArrayOutputStream errorBytes = UnsynchronizedByteArrayOutputStream.builder().get(); @BeforeEach public void setUp() throws UnsupportedEncodingException { @@ -77,7 +77,7 @@ public class TestXLSX2CSV { @Test public void testSampleFile() throws Exception { - final UnsynchronizedByteArrayOutputStream outputBytes = new UnsynchronizedByteArrayOutputStream(); + final UnsynchronizedByteArrayOutputStream outputBytes = UnsynchronizedByteArrayOutputStream.builder().get(); PrintStream out = new PrintStream(outputBytes, true, StandardCharsets.UTF_8.name()); // The package open is instantaneous, as it should be. @@ -96,7 +96,7 @@ public class TestXLSX2CSV { @Test public void testMinColumns() throws Exception { - final UnsynchronizedByteArrayOutputStream outputBytes = new UnsynchronizedByteArrayOutputStream(); + final UnsynchronizedByteArrayOutputStream outputBytes = UnsynchronizedByteArrayOutputStream.builder().get(); PrintStream out = new PrintStream(outputBytes, true, StandardCharsets.UTF_8.name()); // The package open is instantaneous, as it should be. |