*/
protected static OPCPackage newPackage() {
try {
- OPCPackage pkg = OPCPackage.create(PackageHelper.createTempFile());
+ OPCPackage pkg = OPCPackage.create(new ByteArrayOutputStream());
// Main part
PackagePartName corePartName = PackagingURIHelper.createPartName(XSSFRelation.WORKBOOK.getDefaultFileName());
// Create main part relationship
==================================================================== */
package org.apache.poi.xwpf.usermodel;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
*/
protected static OPCPackage newPackage() {
try {
- OPCPackage pkg = OPCPackage.create(PackageHelper.createTempFile());
+ OPCPackage pkg = OPCPackage.create(new ByteArrayOutputStream());
// Main part
PackagePartName corePartName = PackagingURIHelper.createPartName(XWPFRelation.DOCUMENT.getDefaultFileName());
// Create main part relationship
import junit.framework.TestCase;
+import org.apache.poi.util.TempFile;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class TestWorkbookProtection extends TestCase {
wb.lockRevision();
- File tempFile = File.createTempFile("workbookProtection", ".xlsx");
+ File tempFile = TempFile.createTempFile("workbookProtection", ".xlsx");
FileOutputStream out = new FileOutputStream(tempFile);
wb.write(out);
out.close();
import junit.framework.TestCase;
+import org.apache.poi.util.TempFile;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
r1.setText("Lorem ipsum dolor sit amet.");
doc.enforceCommentsProtection();
- File tempFile = File.createTempFile("documentProtectionFile", ".docx");
+ File tempFile = TempFile.createTempFile("documentProtectionFile", ".docx");
FileOutputStream out = new FileOutputStream(tempFile);
doc.write(out);
import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.POIDataSamples;
+import org.apache.poi.util.TempFile;
/**
* <p>Tests HPSF's high-level writing functionality for the well-known property
/* Write the POI filesystem to a (temporary) file <em>doc2</em>
* and close the latter. */
- final File doc2 = File.createTempFile("POI_HPSF_Test.", ".tmp");
+ final File doc2 = TempFile.createTempFile("POI_HPSF_Test.", ".tmp");
doc2.deleteOnExit();
OutputStream out = new FileOutputStream(doc2);
poifs.writeFilesystem(out);
/*
* <li><p>Write the POI filesystem to a (temporary) file <em>doc3</em>
* and close the latter. */
- final File doc3 = File.createTempFile("POI_HPSF_Test.", ".tmp");
+ final File doc3 = TempFile.createTempFile("POI_HPSF_Test.", ".tmp");
doc3.deleteOnExit();
out = new FileOutputStream(doc3);
poifs.writeFilesystem(out);