[bug-57342] add SXSSFWorkbook setZip64Mode method

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1848179 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2018-12-04 21:51:56 +00:00
parent a83a20d718
commit 3c313a7f66
1 changed files with 17 additions and 7 deletions

View File

@ -32,6 +32,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.apache.commons.compress.archivers.zip.Zip64Mode;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.OPCPackage;
@ -51,13 +52,7 @@ import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.SheetVisibility; import org.apache.poi.ss.usermodel.SheetVisibility;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.*;
import org.apache.poi.util.Internal;
import org.apache.poi.util.NotImplemented;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.Removal;
import org.apache.poi.util.TempFile;
import org.apache.poi.xssf.model.SharedStringsTable; import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.usermodel.XSSFChartSheet; import org.apache.poi.xssf.usermodel.XSSFChartSheet;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
@ -117,6 +112,8 @@ public class SXSSFWorkbook implements Workbook {
*/ */
private final SharedStringsTable _sharedStringSource; private final SharedStringsTable _sharedStringSource;
private Zip64Mode zip64Mode = Zip64Mode.AsNeeded;
/** /**
* Construct a new workbook with default row window size * Construct a new workbook with default row window size
*/ */
@ -250,6 +247,7 @@ public class SXSSFWorkbook implements Workbook {
} }
} }
} }
/** /**
* Construct an empty workbook and specify the window for row access. * Construct an empty workbook and specify the window for row access.
* <p> * <p>
@ -290,6 +288,16 @@ public class SXSSFWorkbook implements Workbook {
_randomAccessWindowSize = rowAccessWindowSize; _randomAccessWindowSize = rowAccessWindowSize;
} }
/**
* @param zip64Mode {@link Zip64Mode}
*
* @since 4.0.3
*/
@Beta
public void setZip64Mode(Zip64Mode zip64Mode) {
this.zip64Mode = zip64Mode;
}
/** /**
* Get whether temp files should be compressed. * Get whether temp files should be compressed.
* *
@ -298,6 +306,7 @@ public class SXSSFWorkbook implements Workbook {
public boolean isCompressTempFiles() { public boolean isCompressTempFiles() {
return _compressTmpFiles; return _compressTmpFiles;
} }
/** /**
* Set whether temp files should be compressed. * Set whether temp files should be compressed.
* <p> * <p>
@ -377,6 +386,7 @@ public class SXSSFWorkbook implements Workbook {
protected void injectData(ZipEntrySource zipEntrySource, OutputStream out) throws IOException { protected void injectData(ZipEntrySource zipEntrySource, OutputStream out) throws IOException {
ZipArchiveOutputStream zos = new ZipArchiveOutputStream(out); ZipArchiveOutputStream zos = new ZipArchiveOutputStream(out);
zos.setUseZip64(zip64Mode);
try { try {
Enumeration<? extends ZipArchiveEntry> en = zipEntrySource.getEntries(); Enumeration<? extends ZipArchiveEntry> en = zipEntrySource.getEntries();
while (en.hasMoreElements()) { while (en.hasMoreElements()) {