diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2021-05-14 00:37:50 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2021-05-14 00:37:50 +0000 |
commit | 0614835c55f44ab6f3e9b0850ca51e0e53a65a49 (patch) | |
tree | 586c68c89edb0978a441facf0066ff56d84fa2c7 /poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java | |
parent | fe753d473788fc24030d7066654c56c33fff23b5 (diff) | |
download | poi-0614835c55f44ab6f3e9b0850ca51e0e53a65a49.tar.gz poi-0614835c55f44ab6f3e9b0850ca51e0e53a65a49.zip |
#65304 - Add commons-io as a dependency
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1889871 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java')
-rw-r--r-- | poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java index 9a1defbf21..ec291e1c0b 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java @@ -23,11 +23,10 @@ import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.ref.WeakReference; +import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream; import org.apache.poi.sl.draw.Drawable; import org.apache.poi.sl.usermodel.GroupShape; import org.apache.poi.sl.usermodel.Notes; @@ -40,7 +39,6 @@ import org.apache.poi.sl.usermodel.SlideShowFactory; import org.apache.poi.sl.usermodel.TextParagraph; import org.apache.poi.sl.usermodel.TextRun; import org.apache.poi.sl.usermodel.TextShape; -import org.junit.jupiter.api.Assumptions; import org.junit.platform.commons.util.ExceptionUtils; public abstract class SlideShowHandler extends POIFSFileHandler { @@ -51,29 +49,18 @@ public abstract class SlideShowHandler extends POIFSFileHandler { readPictures(ss); // write out the file - ByteArrayOutputStream out = writeToArray(ss); + UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream(); + ss.write(out); readContent(ss); // read in the written file - try (SlideShow<?, ?> read = SlideShowFactory.create(new ByteArrayInputStream(out.toByteArray()))) { + try (SlideShow<?, ?> read = SlideShowFactory.create(out.toInputStream())) { assertNotNull(read); readContent(read); } } - private ByteArrayOutputStream writeToArray(SlideShow<?,?> ss) throws IOException { - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - try { - ss.write(stream); - } finally { - stream.close(); - } - - return stream; - } - - private void readContent(SlideShow<?,?> ss) { for (Slide<?,?> s : ss.getSlides()) { s.getTitle(); |