diff options
author | Nick Burch <nick@apache.org> | 2014-07-24 18:58:27 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2014-07-24 18:58:27 +0000 |
commit | 7db6e8557e69b40bb4c8896aa380af8fe8732f46 (patch) | |
tree | bb07f15441a85e76bd17ab9c7b3815a70d09bec3 /src/ooxml/java/org/apache/poi/xssf/streaming | |
parent | e2f26b630c10fd34197c0d7f82f815f0417f18e0 (diff) | |
download | poi-7db6e8557e69b40bb4c8896aa380af8fe8732f46.tar.gz poi-7db6e8557e69b40bb4c8896aa380af8fe8732f46.zip |
Patch from Raúl Wegmann from bug #56735 / GitHub Pull #10 - Rationalise POI temp file creation to the TempFile util class, and allow a system wide setting of where Temp files (eg for SXSSF) go, via TempFile / TempFileCreationStrategy
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1613246 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xssf/streaming')
3 files changed, 8 insertions, 5 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java index dbe7c12a31..d194f4fb16 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java @@ -29,6 +29,7 @@ import java.io.Writer; import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
+import org.apache.poi.util.TempFile;
import org.apache.poi.xssf.model.SharedStringsTable;
/**
@@ -51,8 +52,8 @@ public class GZIPSheetDataWriter extends SheetDataWriter { * @return temp file to write sheet data
*/
@Override
- public File createTempFile()throws IOException {
- return File.createTempFile("poi-sxssf-sheet-xml", ".gz");
+ public File createTempFile() throws IOException {
+ return TempFile.createTempFile("poi-sxssf-sheet-xml", ".gz");
}
/**
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java index 2f1d55947b..576e0b8f81 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -43,6 +43,7 @@ import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.util.TempFile; import org.apache.poi.xssf.model.SharedStringsTable; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -820,7 +821,7 @@ public class SXSSFWorkbook implements Workbook } //Save the template - File tmplFile = File.createTempFile("poi-sxssf-template", ".xlsx"); + File tmplFile = TempFile.createTempFile("poi-sxssf-template", ".xlsx"); try { FileOutputStream os = new FileOutputStream(tmplFile); diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java index fbdda65436..95b3a0bcb9 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java @@ -33,6 +33,7 @@ import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.FormulaError;
import org.apache.poi.ss.util.CellReference;
+import org.apache.poi.util.TempFile;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellType;
@@ -75,8 +76,8 @@ public class SheetDataWriter { *
* @return temp file to write sheet data
*/
- public File createTempFile()throws IOException {
- return File.createTempFile("poi-sxssf-sheet", ".xml");
+ public File createTempFile() throws IOException {
+ return TempFile.createTempFile("poi-sxssf-sheet", ".xml");
}
/**
|