You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2011/01/01 06:28:31 UTC

svn commit: r1054189 - /poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java

Author: nick
Date: Sat Jan  1 05:28:30 2011
New Revision: 1054189

URL: http://svn.apache.org/viewvc?rev=1054189&view=rev
Log:
Fix generics warnings, and add another constructor

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?rev=1054189&r1=1054188&r2=1054189&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java Sat Jan  1 05:28:30 2011
@@ -113,13 +113,13 @@ public final class HSSFWorkbook extends 
      * 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 
 	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 {
@@ -249,6 +249,26 @@ public final class HSSFWorkbook extends 
     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 
            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);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org