make SXSSFWorkbook member variables private

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1725047 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-01-16 22:58:25 +00:00
parent 14beee1cfd
commit 0173f22787
2 changed files with 17 additions and 18 deletions

View File

@ -28,6 +28,7 @@ import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
@ -71,29 +72,29 @@ public class SXSSFWorkbook implements Workbook {
/** /**
* Specifies how many rows can be accessed at most via getRow(). * Specifies how many rows can be accessed at most via getRow().
* When a new node is created via createRow() and the total number * When a new node is created via createRow() and the total number
* of unflushed records would exeed the specified value, then the * of unflushed records would exceed the specified value, then the
* row with the lowest index value is flushed and cannot be accessed * row with the lowest index value is flushed and cannot be accessed
* via getRow() anymore. * via getRow() anymore.
*/ */
public static final int DEFAULT_WINDOW_SIZE = 100; public static final int DEFAULT_WINDOW_SIZE = 100;
private static POILogger logger = POILogFactory.getLogger(SXSSFWorkbook.class); private static final POILogger logger = POILogFactory.getLogger(SXSSFWorkbook.class);
XSSFWorkbook _wb; private final XSSFWorkbook _wb;
HashMap<SXSSFSheet,XSSFSheet> _sxFromXHash=new HashMap<SXSSFSheet,XSSFSheet>(); private final Map<SXSSFSheet,XSSFSheet> _sxFromXHash = new HashMap<SXSSFSheet,XSSFSheet>();
HashMap<XSSFSheet,SXSSFSheet> _xFromSxHash=new HashMap<XSSFSheet,SXSSFSheet>(); private final Map<XSSFSheet,SXSSFSheet> _xFromSxHash = new HashMap<XSSFSheet,SXSSFSheet>();
private int _randomAccessWindowSize = DEFAULT_WINDOW_SIZE; private int _randomAccessWindowSize = DEFAULT_WINDOW_SIZE;
/** /**
* whetehr temp files should be compressed. * whether temp files should be compressed.
*/ */
private boolean _compressTmpFiles = false; private boolean _compressTmpFiles = false;
/** /**
* shared string table - a cache of strings in this workbook * shared string table - a cache of strings in this workbook
*/ */
private SharedStringsTable _sharedStringSource = null; private final SharedStringsTable _sharedStringSource;
/** /**
* Construct a new workbook * Construct a new workbook
@ -220,16 +221,12 @@ public class SXSSFWorkbook implements Workbook {
if (workbook == null) if (workbook == null)
{ {
_wb=new XSSFWorkbook(); _wb=new XSSFWorkbook();
if(useSharedStringsTable){ _sharedStringSource = useSharedStringsTable ? _wb.getSharedStringSource() : null;
_sharedStringSource = _wb.getSharedStringSource();
}
} }
else else
{ {
_wb=workbook; _wb=workbook;
if(useSharedStringsTable){ _sharedStringSource = useSharedStringsTable ? _wb.getSharedStringSource() : null;
_sharedStringSource = _wb.getSharedStringSource();
}
for ( int i = 0; i < _wb.getNumberOfSheets(); i++ ) for ( int i = 0; i < _wb.getNumberOfSheets(); i++ )
{ {
XSSFSheet sheet = _wb.getSheetAt( i ); XSSFSheet sheet = _wb.getSheetAt( i );

View File

@ -310,14 +310,16 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
} }
} }
for (SXSSFSheet sheet : wb._sxFromXHash.keySet()) { for (Sheet sheet : wb) {
assertTrue(sheet.getSheetDataWriter().getTempFile().exists()); SXSSFSheet sxSheet = (SXSSFSheet) sheet;
assertTrue(sxSheet.getSheetDataWriter().getTempFile().exists());
} }
assertTrue(wb.dispose()); assertTrue(wb.dispose());
for (SXSSFSheet sheet : wb._sxFromXHash.keySet()) { for (Sheet sheet : wb) {
assertFalse(sheet.getSheetDataWriter().getTempFile().exists()); SXSSFSheet sxSheet = (SXSSFSheet) sheet;
assertFalse(sxSheet.getSheetDataWriter().getTempFile().exists());
} }
} }