aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/util/IOUtils.java
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2017-07-13 04:19:20 +0000
committerJaven O'Neal <onealj@apache.org>2017-07-13 04:19:20 +0000
commit5c2267081d3fbdd5ee3cad9b1ebc2bf5db711975 (patch)
treef30712b6300d6f1d815d7039b31295a2b8b8fdf2 /src/java/org/apache/poi/util/IOUtils.java
parent4364dd5d022a621fd65f51e5cdb0e554af6bfb9d (diff)
downloadpoi-5c2267081d3fbdd5ee3cad9b1ebc2bf5db711975.tar.gz
poi-5c2267081d3fbdd5ee3cad9b1ebc2bf5db711975.zip
replace commented-out throw-away code that writes workbook to C:\temp\xxxxx.xlsx for manual review with XSSFTestDataSamples.writeOut(wb, "bug xxxxx for manual review")
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1801801 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/util/IOUtils.java')
-rw-r--r--src/java/org/apache/poi/util/IOUtils.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/util/IOUtils.java b/src/java/org/apache/poi/util/IOUtils.java
index 1ae7ed8d65..d8938a61db 100644
--- a/src/java/org/apache/poi/util/IOUtils.java
+++ b/src/java/org/apache/poi/util/IOUtils.java
@@ -210,6 +210,17 @@ public final class IOUtils {
}
}
+ /**
+ * Write a ({@link org.apache.poi.ss.usermodel.Workbook}) to an output stream and close the output stream.
+ * This will attempt to close the output stream at the end even if there was a problem writing the document to the stream.
+ *
+ * If you are using Java 7 or higher, you may prefer to use a try-with-resources statement instead.
+ * This function exists for Java 6 code.
+ *
+ * @param doc a writeable document to write to the output stream
+ * @param out the output stream that the document is written to
+ * @throws IOException
+ */
public static void write(Workbook doc, OutputStream out) throws IOException {
try {
doc.write(out);