]> source.dussan.org Git - poi.git/commitdiff
Fix generics warnings, and add another constructor
authorNick Burch <nick@apache.org>
Sat, 1 Jan 2011 05:28:30 +0000 (05:28 +0000)
committerNick Burch <nick@apache.org>
Sat, 1 Jan 2011 05:28:30 +0000 (05:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1054189 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java

index 5af79e921ef3dd7890f43df8bf08dae8c661625e..f5b4423b35df84544a4accfac0e5a6ebb7d3b609 100644 (file)
@@ -113,13 +113,13 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
      * this holds the HSSFSheet objects attached to this workbook
      */
 
-    protected List _sheets;
+    protected List<HSSFSheet> _sheets;
 
     /**
      * this holds the HSSFName objects attached to this workbook
      */
 
-    private ArrayList names;
+    private ArrayList<HSSFName> names;
 
     /**
      * this holds the HSSFFont objects attached to this workbook.
@@ -170,8 +170,8 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
        private HSSFWorkbook(InternalWorkbook book) {
                super((DirectoryNode)null);
                workbook = book;
-               _sheets = new ArrayList(INITIAL_CAPACITY);
-               names = new ArrayList(INITIAL_CAPACITY);
+               _sheets = new ArrayList<HSSFSheet>(INITIAL_CAPACITY);
+               names = new ArrayList<HSSFName>(INITIAL_CAPACITY);
        }
 
     public HSSFWorkbook(POIFSFileSystem fs) throws IOException {
@@ -248,6 +248,26 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
      */
     public HSSFWorkbook(DirectoryNode directory, POIFSFileSystem fs, boolean preserveNodes)
             throws IOException
+    {
+       this(directory, preserveNodes);
+    }
+    
+    /**
+     * given a POI POIFSFileSystem object, and a specific directory
+     *  within it, read in its Workbook and populate the high and
+     *  low level models.  If you're reading in a workbook...start here.
+     *
+     * @param directory the POI filesystem directory to process from
+     * @param fs the POI filesystem that contains the Workbook stream.
+     * @param preserveNodes whether to preseve other nodes, such as
+     *        macros.  This takes more memory, so only say yes if you
+     *        need to. If set, will store all of the POIFSFileSystem
+     *        in memory
+     * @see org.apache.poi.poifs.filesystem.POIFSFileSystem
+     * @exception IOException if the stream cannot be read
+     */
+    public HSSFWorkbook(DirectoryNode directory, boolean preserveNodes)
+            throws IOException
     {
         super(directory);
         String workbookName = getWorkbookDirEntryName(directory);
@@ -260,14 +280,14 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
            this.directory = null;
         }
 
-        _sheets = new ArrayList(INITIAL_CAPACITY);
-        names  = new ArrayList(INITIAL_CAPACITY);
+        _sheets = new ArrayList<HSSFSheet>(INITIAL_CAPACITY);
+        names  = new ArrayList<HSSFName>(INITIAL_CAPACITY);
 
         // Grab the data from the workbook stream, however
         //  it happens to be spelled.
         InputStream stream = directory.createDocumentInputStream(workbookName);
 
-        List records = RecordFactory.createRecords(stream);
+        List<Record> records = RecordFactory.createRecords(stream);
 
         workbook = InternalWorkbook.createWorkbook(records);
         setPropertiesFromWorkbook(workbook);