poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1678801 - in /poi/trunk/src: java/org/apache/poi/ java/org/apache/poi/hpsf/ java/org/apache/poi/hssf/dev/ java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/poifs/crypt/ java/org/apache/poi/poifs/crypt/cryptoapi/ java/org/apache/poi/p...
Date Mon, 11 May 2015 18:59:12 GMT
Author: nick
Date: Mon May 11 18:59:10 2015
New Revision: 1678801

URL: http://svn.apache.org/r1678801
Log:
#56791 More updates from OPOIFS to NPOIFS

Modified:
    poi/trunk/src/java/org/apache/poi/POIDocument.java
    poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java
    poi/trunk/src/java/org/apache/poi/hssf/dev/BiffDrawingToXml.java
    poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
    poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java
    poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java
    poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
    poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java
    poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java
    poi/trunk/src/java/org/apache/poi/util/DrawingDump.java
    poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
    poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
    poi/trunk/src/testcases/org/apache/poi/TestPOIDocumentMain.java
    poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java
    poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

Modified: poi/trunk/src/java/org/apache/poi/POIDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/POIDocument.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/POIDocument.java (original)
+++ poi/trunk/src/java/org/apache/poi/POIDocument.java Mon May 11 18:59:10 2015
@@ -33,6 +33,7 @@ import org.apache.poi.poifs.crypt.Encryp
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
@@ -65,13 +66,24 @@ public abstract class POIDocument {
     	this.directory = dir;
     }
 
-    protected POIDocument(POIFSFileSystem fs) {
+    /**
+     * Constructs from an old-style OPOIFS
+     */
+    protected POIDocument(OPOIFSFileSystem fs) {
        this(fs.getRoot());
     }
-    
+    /**
+     * Constructs from an old-style OPOIFS
+     */
     protected POIDocument(NPOIFSFileSystem fs) {
        this(fs.getRoot());
     }
+    /**
+     * Constructs from the default POIFS
+     */
+    protected POIDocument(POIFSFileSystem fs) {
+        this(fs.getRoot());
+     }
 
     /**
      * Fetch the Document Summary Information of the document

Modified: poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/HPSFPropertiesOnlyDocument.java Mon May 11 18:59:10 2015
@@ -24,6 +24,7 @@ import java.util.List;
 import org.apache.poi.POIDocument;
 import org.apache.poi.poifs.filesystem.EntryUtils;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 /**
@@ -36,6 +37,9 @@ public class HPSFPropertiesOnlyDocument
     public HPSFPropertiesOnlyDocument(NPOIFSFileSystem fs) {
         super(fs.getRoot());
     }
+    public HPSFPropertiesOnlyDocument(OPOIFSFileSystem fs) {
+        super(fs);
+    }
     public HPSFPropertiesOnlyDocument(POIFSFileSystem fs) {
         super(fs);
     }

Modified: poi/trunk/src/java/org/apache/poi/hssf/dev/BiffDrawingToXml.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/dev/BiffDrawingToXml.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/dev/BiffDrawingToXml.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/dev/BiffDrawingToXml.java Mon May 11 18:59:10 2015
@@ -34,7 +34,7 @@ import org.apache.poi.hssf.record.Drawin
 import org.apache.poi.hssf.record.EscherAggregate;
 import org.apache.poi.hssf.usermodel.HSSFPatriarch;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 
 /**
  * Utility for representing drawings contained in a binary Excel file as a XML tree
@@ -138,7 +138,7 @@ public class BiffDrawingToXml {
     }
 
     public static void writeToFile(OutputStream fos, InputStream xlsWorkbook, boolean excludeWorkbookRecords, String[] params) throws IOException {
-        POIFSFileSystem fs = new POIFSFileSystem(xlsWorkbook);
+        NPOIFSFileSystem fs = new NPOIFSFileSystem(xlsWorkbook);
         HSSFWorkbook workbook = new HSSFWorkbook(fs);
         InternalWorkbook internalWorkbook = getInternalWorkbook(workbook);
         DrawingGroupRecord r = (DrawingGroupRecord) internalWorkbook.findFirstRecordBySid(DrawingGroupRecord.sid);

Modified: poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/dev/BiffViewer.java Mon May 11 18:59:10 2015
@@ -17,13 +17,63 @@
 
 package org.apache.poi.hssf.dev;
 
-import java.io.*;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.Writer;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.record.RecordInputStream.LeftoverDataException;
-import org.apache.poi.hssf.record.chart.*;
+import org.apache.poi.hssf.record.chart.AreaFormatRecord;
+import org.apache.poi.hssf.record.chart.AreaRecord;
+import org.apache.poi.hssf.record.chart.AxisLineFormatRecord;
+import org.apache.poi.hssf.record.chart.AxisOptionsRecord;
+import org.apache.poi.hssf.record.chart.AxisParentRecord;
+import org.apache.poi.hssf.record.chart.AxisRecord;
+import org.apache.poi.hssf.record.chart.AxisUsedRecord;
+import org.apache.poi.hssf.record.chart.BarRecord;
+import org.apache.poi.hssf.record.chart.BeginRecord;
+import org.apache.poi.hssf.record.chart.CatLabRecord;
+import org.apache.poi.hssf.record.chart.CategorySeriesAxisRecord;
+import org.apache.poi.hssf.record.chart.ChartEndBlockRecord;
+import org.apache.poi.hssf.record.chart.ChartEndObjectRecord;
+import org.apache.poi.hssf.record.chart.ChartFRTInfoRecord;
+import org.apache.poi.hssf.record.chart.ChartFormatRecord;
+import org.apache.poi.hssf.record.chart.ChartRecord;
+import org.apache.poi.hssf.record.chart.ChartStartBlockRecord;
+import org.apache.poi.hssf.record.chart.ChartStartObjectRecord;
+import org.apache.poi.hssf.record.chart.DatRecord;
+import org.apache.poi.hssf.record.chart.DataFormatRecord;
+import org.apache.poi.hssf.record.chart.DefaultDataLabelTextPropertiesRecord;
+import org.apache.poi.hssf.record.chart.EndRecord;
+import org.apache.poi.hssf.record.chart.FontBasisRecord;
+import org.apache.poi.hssf.record.chart.FontIndexRecord;
+import org.apache.poi.hssf.record.chart.FrameRecord;
+import org.apache.poi.hssf.record.chart.LegendRecord;
+import org.apache.poi.hssf.record.chart.LineFormatRecord;
+import org.apache.poi.hssf.record.chart.LinkedDataRecord;
+import org.apache.poi.hssf.record.chart.ObjectLinkRecord;
+import org.apache.poi.hssf.record.chart.PlotAreaRecord;
+import org.apache.poi.hssf.record.chart.PlotGrowthRecord;
+import org.apache.poi.hssf.record.chart.SeriesIndexRecord;
+import org.apache.poi.hssf.record.chart.SeriesListRecord;
+import org.apache.poi.hssf.record.chart.SeriesRecord;
+import org.apache.poi.hssf.record.chart.SeriesTextRecord;
+import org.apache.poi.hssf.record.chart.SeriesToChartGroupRecord;
+import org.apache.poi.hssf.record.chart.SheetPropertiesRecord;
+import org.apache.poi.hssf.record.chart.TextRecord;
+import org.apache.poi.hssf.record.chart.TickRecord;
+import org.apache.poi.hssf.record.chart.UnitsRecord;
+import org.apache.poi.hssf.record.chart.ValueRangeRecord;
 import org.apache.poi.hssf.record.pivottable.DataItemRecord;
 import org.apache.poi.hssf.record.pivottable.ExtendedPivotTableViewFieldsRecord;
 import org.apache.poi.hssf.record.pivottable.PageItemRecord;
@@ -32,7 +82,7 @@ import org.apache.poi.hssf.record.pivott
 import org.apache.poi.hssf.record.pivottable.ViewFieldsRecord;
 import org.apache.poi.hssf.record.pivottable.ViewSourceRecord;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.LittleEndian;
 
@@ -420,7 +470,7 @@ public final class BiffViewer {
 
 	protected static InputStream getPOIFSInputStream(File file)
 			throws IOException, FileNotFoundException {
-		POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
+		NPOIFSFileSystem fs = new NPOIFSFileSystem(new FileInputStream(file));
 		String workbookName = HSSFWorkbook.getWorkbookDirEntryName(fs.getRoot());
 		return fs.createDocumentInputStream(workbookName);
 	}

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java Mon May 11 18:59:10 2015
@@ -45,7 +45,6 @@ import org.apache.poi.hssf.record.ObjRec
 import org.apache.poi.hssf.util.CellReference;
 import org.apache.poi.poifs.filesystem.DirectoryEntry;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.ss.usermodel.Chart;
 import org.apache.poi.ss.usermodel.ClientAnchor;
 import org.apache.poi.ss.usermodel.Drawing;

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=1678801&r1=1678800&r2=1678801&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 Mon May 11 18:59:10 2015
@@ -206,6 +206,19 @@ public final class HSSFWorkbook extends
     public HSSFWorkbook(POIFSFileSystem fs) throws IOException {
         this(fs,true);
     }
+    /**
+     * Given a POI POIFSFileSystem object, read in its Workbook along
+     *  with all related nodes, and populate the high and low level models.
+     * <p>This calls {@link #HSSFWorkbook(POIFSFileSystem, boolean)} with
+     *  preserve nodes set to true. 
+     * 
+     * @see #HSSFWorkbook(POIFSFileSystem, boolean)
+     * @see org.apache.poi.poifs.filesystem.POIFSFileSystem
+     * @exception IOException if the stream cannot be read
+     */
+    public HSSFWorkbook(NPOIFSFileSystem fs) throws IOException {
+        this(fs.getRoot(),true);
+    }
 
     /**
      * Given a POI POIFSFileSystem object, read in its Workbook and populate 
@@ -379,7 +392,7 @@ public final class HSSFWorkbook extends
     public HSSFWorkbook(InputStream s, boolean preserveNodes)
             throws IOException
     {
-        this(new POIFSFileSystem(s), preserveNodes);
+        this(new NPOIFSFileSystem(s).getRoot(), preserveNodes);
     }
 
     /**
@@ -1844,7 +1857,7 @@ public final class HSSFWorkbook extends
     throws IOException {
     	// check if we were created by POIFS otherwise create a new dummy POIFS for storing the package data
     	if (directory == null) {
-    		directory = new POIFSFileSystem().getRoot();
+    		directory = new NPOIFSFileSystem().getRoot();
     		preserveNodes = true;
     	}
     	

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java Mon May 11 18:59:10 2015
@@ -25,6 +25,7 @@ import javax.crypto.SecretKey;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 public abstract class Decryptor {
@@ -84,7 +85,9 @@ public abstract class Decryptor {
     public InputStream getDataStream(NPOIFSFileSystem fs) throws IOException, GeneralSecurityException {
         return getDataStream(fs.getRoot());
     }
-
+    public InputStream getDataStream(OPOIFSFileSystem fs) throws IOException, GeneralSecurityException {
+        return getDataStream(fs.getRoot());
+    }
     public InputStream getDataStream(POIFSFileSystem fs) throws IOException, GeneralSecurityException {
         return getDataStream(fs.getRoot());
     }

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java Mon May 11 18:59:10 2015
@@ -26,6 +26,7 @@ import java.io.IOException;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
@@ -75,6 +76,12 @@ public class EncryptionInfo {
        this(fs.getRoot());
     }
     /**
+     * Opens for decryption
+     */
+    public EncryptionInfo(OPOIFSFileSystem fs) throws IOException {
+       this(fs.getRoot());
+    }
+    /**
      * Opens for decryption
      */
     public EncryptionInfo(NPOIFSFileSystem fs) throws IOException {

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/Encryptor.java Mon May 11 18:59:10 2015
@@ -24,6 +24,7 @@ import javax.crypto.SecretKey;
 
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 
 public abstract class Encryptor {
@@ -51,7 +52,9 @@ public abstract class Encryptor {
     public OutputStream getDataStream(NPOIFSFileSystem fs) throws IOException, GeneralSecurityException {
         return getDataStream(fs.getRoot());
     }
-
+    public OutputStream getDataStream(OPOIFSFileSystem fs) throws IOException, GeneralSecurityException {
+        return getDataStream(fs.getRoot());
+    }
     public OutputStream getDataStream(POIFSFileSystem fs) throws IOException, GeneralSecurityException {
         return getDataStream(fs.getRoot());
     }

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java Mon May 11 18:59:10 2015
@@ -40,7 +40,7 @@ import org.apache.poi.poifs.crypt.HashAl
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
 import org.apache.poi.poifs.filesystem.DocumentNode;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.BitField;
 import org.apache.poi.util.BitFieldFactory;
 import org.apache.poi.util.BoundedInputStream;
@@ -200,7 +200,7 @@ public class CryptoAPIDecryptor extends
     @SuppressWarnings("unused")
     public InputStream getDataStream(DirectoryNode dir)
     throws IOException, GeneralSecurityException {
-        POIFSFileSystem fsOut = new POIFSFileSystem();
+        NPOIFSFileSystem fsOut = new NPOIFSFileSystem();
         DocumentNode es = (DocumentNode) dir.getEntry("EncryptedSummary");
         DocumentInputStream dis = dir.createDocumentInputStream(es);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -240,6 +240,7 @@ public class CryptoAPIDecryptor extends
         sbis = null;
         bos.reset();
         fsOut.writeFilesystem(bos);
+        fsOut.close();
         _length = bos.size();
         ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
         return bis;

Modified: poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSDump.java Mon May 11 18:59:10 2015
@@ -26,10 +26,7 @@ import java.io.OutputStream;
 import java.util.Iterator;
 
 /**
- *
  * Dump internal structure of a OLE2 file into file system
- *
- * @author Yegor Kozlov
  */
 public class POIFSDump {
 
@@ -37,7 +34,7 @@ public class POIFSDump {
         for (int i = 0; i < args.length; i++) {
             System.out.println("Dumping " + args[i]);
             FileInputStream is = new FileInputStream(args[i]);
-            POIFSFileSystem fs = new POIFSFileSystem(is);
+            NPOIFSFileSystem fs = new NPOIFSFileSystem(is);
             is.close();
 
             DirectoryEntry root = fs.getRoot();

Modified: poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/dev/POIFSViewer.java Mon May 11 18:59:10 2015
@@ -19,12 +19,12 @@
 
 package org.apache.poi.poifs.dev;
 
-import java.io.FileInputStream;
+import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 
 /**
  * A simple viewer for POIFS files
@@ -76,10 +76,10 @@ public class POIFSViewer
         try
         {
             POIFSViewable fs      =
-                new POIFSFileSystem(new FileInputStream(filename));
-            List<String>          strings = POIFSViewEngine.inspectViewable(fs, true,
+                new NPOIFSFileSystem(new File(filename));
+            List<String>  strings = POIFSViewEngine.inspectViewable(fs, true,
                                         0, "  ");
-            Iterator<String>      iter    = strings.iterator();
+            Iterator<String> iter = strings.iterator();
 
             while (iter.hasNext())
             {

Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/DocumentInputStream.java Mon May 11 18:59:10 2015
@@ -58,7 +58,7 @@ public class DocumentInputStream extends
 
 	   if(documentNode.getDocument() != null) {
 	      delegate = new ODocumentInputStream(document);
-	   } else if(parentNode.getFileSystem() != null) {
+	   } else if(parentNode.getOFileSystem() != null) {
 	      delegate = new ODocumentInputStream(document);
 	   } else if(parentNode.getNFileSystem() != null) {
 	      delegate = new NDocumentInputStream(document);

Modified: poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java Mon May 11 18:59:10 2015
@@ -377,6 +377,15 @@ public class NPOIFSFileSystem extends Bl
     }
     
     /**
+     * Checks if the supplied first 8 bytes of a stream / file
+     *  has a POIFS (OLE2) header.
+     */
+    public static boolean hasPOIFSHeader(byte[] header8Bytes) {
+        LongField signature = new LongField(HeaderBlockConstants._signature_offset, header8Bytes);
+        return (signature.get() == HeaderBlockConstants._signature);
+    }
+    
+    /**
      * Read and process the PropertiesTable and the
      *  FAT / XFAT blocks, so that we're ready to
      *  work with the file

Modified: poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/property/PropertyTable.java Mon May 11 18:59:10 2015
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.io.OutputStream;
 
 import org.apache.poi.poifs.common.POIFSBigBlockSize;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.poifs.storage.BlockWritable;
 import org.apache.poi.poifs.storage.HeaderBlock;
 import org.apache.poi.poifs.storage.PropertyBlock;

Modified: poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/CloseIgnoringInputStream.java Mon May 11 18:59:10 2015
@@ -20,8 +20,6 @@ package org.apache.poi.util;
 import java.io.FilterInputStream;
 import java.io.InputStream;
 
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-
 /**
  * A wrapper around an {@link InputStream}, which 
  *  ignores close requests made to it.

Modified: poi/trunk/src/java/org/apache/poi/util/DrawingDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/DrawingDump.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/DrawingDump.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/DrawingDump.java Mon May 11 18:59:10 2015
@@ -18,12 +18,12 @@
         
 package org.apache.poi.util;
 
+import java.io.File;
+import java.io.IOException;
+
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-
-import java.io.FileInputStream;
-import java.io.IOException;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 
 /**
  * Dump out the aggregated escher records
@@ -32,8 +32,8 @@ public class DrawingDump
 {
     public static void main( String[] args ) throws IOException
     {
-        POIFSFileSystem fs      =
-                new POIFSFileSystem(new FileInputStream(args[0]));
+        NPOIFSFileSystem fs      =
+                new NPOIFSFileSystem(new File(args[0]));
         HSSFWorkbook wb = new HSSFWorkbook(fs);
         try {
             System.out.println( "Drawing group:" );

Modified: poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/extractor/ExtractorFactory.java Mon May 11 18:59:10 2015
@@ -18,7 +18,6 @@ package org.apache.poi.extractor;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
@@ -51,6 +50,10 @@ import org.apache.poi.openxml4j.opc.Pack
 import org.apache.poi.poifs.filesystem.DirectoryEntry;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.Entry;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NotOLE2FileException;
+import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.xslf.XSLFSlideShow;
 import org.apache.poi.xslf.extractor.XSLFPowerPointExtractor;
@@ -128,16 +131,14 @@ public class ExtractorFactory {
 	public static POITextExtractor createExtractor(File f) throws IOException, InvalidFormatException, OpenXML4JException, XmlException {
 		InputStream inp = null;
         try {
-            inp = new PushbackInputStream(
-                new FileInputStream(f), 8);
-
-            if(POIFSFileSystem.hasPOIFSHeader(inp)) {
-                return createExtractor(new POIFSFileSystem(inp));
-            }
-            if(POIXMLDocument.hasOOXMLHeader(inp)) {
+            try {
+                NPOIFSFileSystem fs = new NPOIFSFileSystem(f);
+                return createExtractor(fs);
+            } catch (OfficeXmlFileException e) {
                 return createExtractor(OPCPackage.open(f.toString(), PackageAccess.READ));
+            } catch (NotOLE2FileException ne) {
+                throw new IllegalArgumentException("Your File was neither an OLE2 file, nor an OOXML file");
             }
-            throw new IllegalArgumentException("Your File was neither an OLE2 file, nor an OOXML file");
         } finally {
             if(inp != null) inp.close();
         }
@@ -150,8 +151,8 @@ public class ExtractorFactory {
 			inp = new PushbackInputStream(inp, 8);
 		}
 
-		if(POIFSFileSystem.hasPOIFSHeader(inp)) {
-			return createExtractor(new POIFSFileSystem(inp));
+		if(NPOIFSFileSystem.hasPOIFSHeader(inp)) {
+			return createExtractor(new NPOIFSFileSystem(inp));
 		}
 		if(POIXMLDocument.hasOOXMLHeader(inp)) {
 			return createExtractor(OPCPackage.open(inp));
@@ -226,16 +227,14 @@ public class ExtractorFactory {
 	   // Only ever an OLE2 one from the root of the FS
 		return (POIOLE2TextExtractor)createExtractor(fs.getRoot());
 	}
-
-    /**
-     * @deprecated Use {@link #createExtractor(DirectoryNode)} instead
-     */
-    @Deprecated
-    public static POITextExtractor createExtractor(DirectoryNode poifsDir, POIFSFileSystem fs)
-            throws IOException, InvalidFormatException, OpenXML4JException, XmlException
-    {
-        return createExtractor(poifsDir);
-    }
+    public static POIOLE2TextExtractor createExtractor(NPOIFSFileSystem fs) throws IOException, InvalidFormatException, OpenXML4JException, XmlException {
+        // Only ever an OLE2 one from the root of the FS
+         return (POIOLE2TextExtractor)createExtractor(fs.getRoot());
+     }
+    public static POIOLE2TextExtractor createExtractor(OPOIFSFileSystem fs) throws IOException, InvalidFormatException, OpenXML4JException, XmlException {
+        // Only ever an OLE2 one from the root of the FS
+         return (POIOLE2TextExtractor)createExtractor(fs.getRoot());
+     }
 
     public static POITextExtractor createExtractor(DirectoryNode poifsDir) throws IOException,
             InvalidFormatException, OpenXML4JException, XmlException

Modified: poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/ss/usermodel/WorkbookFactory.java Mon May 11 18:59:10 2015
@@ -167,7 +167,7 @@ public class WorkbookFactory {
         byte[] header8 = IOUtils.peekFirst8Bytes(inp);
 
         // Try to create
-        if (POIFSFileSystem.hasPOIFSHeader(header8)) {
+        if (NPOIFSFileSystem.hasPOIFSHeader(header8)) {
             NPOIFSFileSystem fs = new NPOIFSFileSystem(inp);
             return create(fs, password);
         }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java Mon May 11 18:59:10 2015
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hdgf.dev;
 
-import java.io.FileInputStream;
+import java.io.File;
 
 import org.apache.poi.hdgf.HDGFDiagram;
 import org.apache.poi.hdgf.chunks.Chunk;
@@ -26,7 +26,7 @@ import org.apache.poi.hdgf.pointers.Poin
 import org.apache.poi.hdgf.streams.ChunkStream;
 import org.apache.poi.hdgf.streams.PointerContainingStream;
 import org.apache.poi.hdgf.streams.Stream;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 
 /**
  * Developer helper class to dump out the pointer+stream structure
@@ -41,7 +41,7 @@ public final class VSDDumper {
 		}
 
 		HDGFDiagram hdgf = new HDGFDiagram(
-				new POIFSFileSystem(new FileInputStream(args[0]))
+				new NPOIFSFileSystem(new File(args[0]))
 		);
 
 		System.out.println("Opened " + args[0]);

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java Mon May 11 18:59:10 2015
@@ -62,7 +62,7 @@ public final class VisioTextExtractor ex
 		this(new HDGFDiagram(dir, fs));
 	}
 	public VisioTextExtractor(InputStream inp) throws IOException {
-		this(new POIFSFileSystem(inp));
+		this(new NPOIFSFileSystem(inp));
 	}
 
 	/**

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java Mon May 11 18:59:10 2015
@@ -51,21 +51,12 @@ public final class HPBFDocument extends
 	   this(fs.getRoot());
 	}
 	public HPBFDocument(InputStream inp) throws IOException {
-	   this(new POIFSFileSystem(inp));
+	   this(new NPOIFSFileSystem(inp));
 	}
 
 	/**
 	 * Opens an embedded publisher document,
 	 *  at the given directory.
-	 * @deprecated Use {@link #HPBFDocument(DirectoryNode)} instead
-	 */
-	@Deprecated
-	public HPBFDocument(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
-	   this(dir);
-	}
-	/**
-	 * Opens an embedded publisher document,
-	 *  at the given directory.
 	 */
 	public HPBFDocument(DirectoryNode dir) throws IOException {
 	   super(dir);

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java Mon May 11 18:59:10 2015
@@ -25,7 +25,7 @@ import org.apache.poi.ddf.DefaultEscherR
 import org.apache.poi.ddf.EscherRecord;
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.StringUtil;
 
@@ -35,12 +35,12 @@ import org.apache.poi.util.StringUtil;
  *  constructed.
  */
 public final class HPBFDumper {
-	private POIFSFileSystem fs;
-	public HPBFDumper(POIFSFileSystem fs) {
+	private NPOIFSFileSystem fs;
+	public HPBFDumper(NPOIFSFileSystem fs) {
 		this.fs = fs;
 	}
 	public HPBFDumper(InputStream inp) throws IOException {
-		this(new POIFSFileSystem(inp));
+		this(new NPOIFSFileSystem(inp));
 	}
 
 	private static byte[] getData(DirectoryNode dir, String name) throws IOException {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java Mon May 11 18:59:10 2015
@@ -24,7 +24,7 @@ import java.io.InputStream;
 import org.apache.poi.hpbf.HPBFDocument;
 import org.apache.poi.hpbf.model.QuillContents;
 import org.apache.poi.hpbf.model.qcbits.QCBit;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.HexDump;
 
 /**
@@ -40,11 +40,11 @@ public final class PLCDumper {
 		doc = hpbfDoc;
 		qc = doc.getQuillContents();
 	}
-	public PLCDumper(POIFSFileSystem fs) throws IOException {
+	public PLCDumper(NPOIFSFileSystem fs) throws IOException {
 		this(new HPBFDocument(fs));
 	}
 	public PLCDumper(InputStream inp) throws IOException {
-		this(new POIFSFileSystem(inp));
+		this(new NPOIFSFileSystem(inp));
 	}
 
 	public static void main(String[] args) throws Exception {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java Mon May 11 18:59:10 2015
@@ -53,10 +53,6 @@ public final class PublisherTextExtracto
    public PublisherTextExtractor(InputStream is) throws IOException {
       this(new POIFSFileSystem(is));
    }
-   @Deprecated
-   public PublisherTextExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
-      this(new HPBFDocument(dir, fs));
-   }
 
 	/**
 	 * Should a call to getText() return hyperlinks inline

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java Mon May 11 18:59:10 2015
@@ -123,7 +123,7 @@ public final class HSLFSlideShow extends
 	 */
 	public HSLFSlideShow(InputStream inputStream) throws IOException {
 		//do Ole stuff
-		this(new POIFSFileSystem(inputStream));
+		this(new NPOIFSFileSystem(inputStream));
 	}
 
 	/**
@@ -150,22 +150,6 @@ public final class HSLFSlideShow extends
       this(filesystem.getRoot());
    }
 
-   /**
-    * Constructs a Powerpoint document from a specific point in a
-    *  POIFS Filesystem. Parses the document and places all the
-    *  important stuff into data structures.
-    *
-    * @deprecated Use {@link #HSLFSlideShow(DirectoryNode)} instead
-    * @param dir the POIFS directory to read from
-    * @param filesystem the POIFS FileSystem to read from
-    * @throws IOException if there is a problem while parsing the document.
-    */
-	@Deprecated
-   public HSLFSlideShow(DirectoryNode dir, POIFSFileSystem filesystem) throws IOException
-   {
-      this(dir);
-   }
-   
 	/**
 	 * Constructs a Powerpoint document from a specific point in a
 	 *  POIFS Filesystem. Parses the document and places all the

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java Mon May 11 18:59:10 2015
@@ -18,7 +18,6 @@
 package org.apache.poi.hslf.dev;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -28,7 +27,7 @@ import java.io.Writer;
 import org.apache.poi.hslf.record.RecordTypes;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.LittleEndian;
 
 /**
@@ -50,9 +49,7 @@ public final class PPTXMLDump {
     protected boolean hexHeader = true;
 
     public PPTXMLDump(File ppt) throws IOException {
-        FileInputStream fis = new FileInputStream(ppt);
-        POIFSFileSystem fs = new POIFSFileSystem(fis);
-        fis.close();
+        NPOIFSFileSystem fs = new NPOIFSFileSystem(ppt);
 
         //read the document entry from OLE file system
         DocumentEntry entry = (DocumentEntry)fs.getRoot().getEntry(PPDOC_ENTRY);

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java Mon May 11 18:59:10 2015
@@ -17,14 +17,17 @@
 
 package org.apache.poi.hslf.dev;
 
-import java.io.*;
-
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-import org.apache.poi.poifs.filesystem.DocumentEntry;
-
-import org.apache.poi.ddf.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.poi.ddf.DefaultEscherRecordFactory;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherRecord;
+import org.apache.poi.ddf.EscherTextboxRecord;
 import org.apache.poi.hslf.record.RecordTypes;
-
+import org.apache.poi.poifs.filesystem.DocumentEntry;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.LittleEndian;
 
 /**
@@ -38,12 +41,9 @@ import org.apache.poi.util.LittleEndian;
  * To peek inside PPDrawings, which hold Escher drawings, we use the
  *  DDF package from POI (but we can fake it by using the Escher listings
  *  from hslf.record.RecordTypes also)
- *
- * @author Nick Burch
  */
 public final class SlideShowDumper {
-  private InputStream istream;
-  private POIFSFileSystem filesystem;
+  private NPOIFSFileSystem filesystem;
 
   private byte[] _docstream;
 
@@ -92,7 +92,7 @@ public final class SlideShowDumper {
    */
   public SlideShowDumper(String fileName) throws IOException
   {
-  	this(new FileInputStream(fileName));
+  	this(new NPOIFSFileSystem(new File(fileName)));
   }
 
   /**
@@ -105,8 +105,7 @@ public final class SlideShowDumper {
   public SlideShowDumper(InputStream inputStream) throws IOException
   {
 	//do Ole stuff
-	this(new POIFSFileSystem(inputStream));
-	istream = inputStream;
+	this(new NPOIFSFileSystem(inputStream));
   }
 
   /**
@@ -116,7 +115,7 @@ public final class SlideShowDumper {
    * @param filesystem the POIFS FileSystem to read from
    * @throws IOException if there is a problem while parsing the document.
    */
-  public SlideShowDumper(POIFSFileSystem filesystem) throws IOException
+  public SlideShowDumper(NPOIFSFileSystem filesystem) throws IOException
   {
 	this.filesystem = filesystem;
 
@@ -153,10 +152,7 @@ public final class SlideShowDumper {
    */
   public void close() throws IOException
   {
-	if(istream != null) {
-		istream.close();
-	}
-	filesystem = null;
+	filesystem.close();
   }
 
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java Mon May 11 18:59:10 2015
@@ -17,6 +17,7 @@
 
 package org.apache.poi.hslf.extractor;
 
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -83,7 +84,7 @@ public final class PowerPointExtractor e
 	 * @param fileName The name of the file to extract from
 	 */
 	public PowerPointExtractor(String fileName) throws IOException {
-		this(new FileInputStream(fileName));
+		this(new NPOIFSFileSystem(new File(fileName)));
 	}
 
 	/**
@@ -92,7 +93,7 @@ public final class PowerPointExtractor e
 	 * @param iStream The input stream containing the PowerPoint document
 	 */
 	public PowerPointExtractor(InputStream iStream) throws IOException {
-		this(new POIFSFileSystem(iStream));
+		this(new NPOIFSFileSystem(iStream));
 	}
 
 	/**
@@ -123,14 +124,6 @@ public final class PowerPointExtractor e
       this(new HSLFSlideShow(dir));
    }
 
-   /**
-    * @deprecated Use {@link #PowerPointExtractor(DirectoryNode)} instead
-    */
-   @Deprecated
-	public PowerPointExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
-		this(new HSLFSlideShow(dir, fs));
-	}
-
 	/**
 	 * Creates a PowerPointExtractor, from a HSLFSlideShow
 	 *

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java Mon May 11 18:59:10 2015
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hslf.extractor;
 
-import java.io.FileInputStream;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -32,7 +32,7 @@ import org.apache.poi.hslf.record.TextBy
 import org.apache.poi.hslf.record.TextCharsAtom;
 import org.apache.poi.hslf.record.TextHeaderAtom;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.util.LittleEndian;
 
 /**
@@ -52,11 +52,9 @@ import org.apache.poi.util.LittleEndian;
  * Almost everyone will want to use @see PowerPointExtractor instead. There
  *  are only a very small number of cases (eg some performance sensitive
  *  lucene indexers) that would ever want to use this!
- *
- * @author Nick Burch
  */
 public final class QuickButCruddyTextExtractor {
-	private POIFSFileSystem fs;
+	private NPOIFSFileSystem fs;
 	private InputStream is;
 	private byte[] pptContents;
 
@@ -84,7 +82,7 @@ public final class QuickButCruddyTextExt
 	 * @param fileName
 	 */
 	public QuickButCruddyTextExtractor(String fileName) throws IOException {
-		this(new FileInputStream(fileName));
+		this(new NPOIFSFileSystem(new File(fileName)));
 	}
 
 	/**
@@ -92,7 +90,7 @@ public final class QuickButCruddyTextExt
 	 * @param iStream
 	 */
 	public QuickButCruddyTextExtractor(InputStream iStream) throws IOException {
-		this(new POIFSFileSystem(iStream));
+		this(new NPOIFSFileSystem(iStream));
 		is = iStream;
 	}
 
@@ -100,7 +98,7 @@ public final class QuickButCruddyTextExt
 	 * Creates an extractor from a POIFS Filesystem
 	 * @param poifs
 	 */
-	public QuickButCruddyTextExtractor(POIFSFileSystem poifs) throws IOException {
+	public QuickButCruddyTextExtractor(NPOIFSFileSystem poifs) throws IOException {
 		fs = poifs;
 
 		// Find the PowerPoint bit, and get out the bytes

Modified: poi/trunk/src/testcases/org/apache/poi/TestPOIDocumentMain.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/TestPOIDocumentMain.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/TestPOIDocumentMain.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/TestPOIDocumentMain.java Mon May 11 18:59:10 2015
@@ -27,7 +27,7 @@ import junit.framework.TestCase;
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
 
 /**
  * Tests that POIDocument correctly loads and saves the common
@@ -97,7 +97,7 @@ public final class TestPOIDocumentMain e
 
 		// Create a new version
 		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-		POIFSFileSystem inFS = new POIFSFileSystem(bais);
+		OPOIFSFileSystem inFS = new OPOIFSFileSystem(bais);
 
 		// Check they're still there
 		doc.directory = inFS.getRoot();

Modified: poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestHPSFBugs.java Mon May 11 18:59:10 2015
@@ -31,7 +31,7 @@ import org.apache.poi.hpsf.PropertySetFa
 import org.apache.poi.hpsf.SummaryInformation;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.poifs.filesystem.DocumentInputStream;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 
 /**
  * Tests various bugs have been fixed
@@ -109,8 +109,8 @@ public final class TestHPSFBugs extends
     */
    public void test54233() throws Exception {
        DocumentInputStream dis;
-       POIFSFileSystem fs = 
-               new POIFSFileSystem(_samples.openResourceAsStream("TestNon4ByteBoundary.doc"));
+       NPOIFSFileSystem fs = 
+               new NPOIFSFileSystem(_samples.openResourceAsStream("TestNon4ByteBoundary.doc"));
        
        dis = fs.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME);
        SummaryInformation si = (SummaryInformation)PropertySetFactory.create(dis);
@@ -130,7 +130,7 @@ public final class TestHPSFBugs extends
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        doc.write(baos);
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-       doc = new HPSFPropertiesOnlyDocument(new POIFSFileSystem(bais));
+       doc = new HPSFPropertiesOnlyDocument(new NPOIFSFileSystem(bais));
        
        // Check properties are still there
        assertEquals("Microsoft Word 10.0", si.getApplicationName());
@@ -144,8 +144,8 @@ public final class TestHPSFBugs extends
     */
    public void test56138() throws Exception {
        DocumentInputStream dis;
-       POIFSFileSystem fs = 
-               new POIFSFileSystem(_samples.openResourceAsStream("TestZeroLengthCodePage.mpp"));
+       NPOIFSFileSystem fs = 
+               new NPOIFSFileSystem(_samples.openResourceAsStream("TestZeroLengthCodePage.mpp"));
        
        dis = fs.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME);
        SummaryInformation si = (SummaryInformation)PropertySetFactory.create(dis);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/HSSFITestDataProvider.java Mon May 11 18:59:10 2015
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hssf;
 
+import java.io.InputStream;
+
 import org.apache.poi.POIDataSamples;
 import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -38,6 +40,9 @@ public final class HSSFITestDataProvider
     public HSSFWorkbook openSampleWorkbook(String sampleFileName) {
         return HSSFTestDataSamples.openSampleWorkbook(sampleFileName);
     }
+    public InputStream openWorkbookStream(String sampleFileName) {
+        return HSSFTestDataSamples.openSampleFileStream(sampleFileName);
+    }
     
     public HSSFWorkbook writeOutAndReadBack(Workbook original) {
         if(!(original instanceof HSSFWorkbook)) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1678801&r1=1678800&r2=1678801&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Mon May 11 18:59:10 2015
@@ -58,6 +58,7 @@ import org.apache.poi.hssf.record.aggreg
 import org.apache.poi.hssf.record.common.UnicodeString;
 import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.poifs.filesystem.OPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.ss.formula.ptg.Area3DPtg;
 import org.apache.poi.ss.formula.ptg.DeletedArea3DPtg;
@@ -1566,15 +1567,30 @@ public final class TestBugs extends Base
      * (is an excel 95 file though)
      */
     @Test
-    public void bug46904() {
+    public void bug46904() throws Exception {
         try {
-            openSample("46904.xls");
+            OPOIFSFileSystem fs = new OPOIFSFileSystem(
+                    HSSFITestDataProvider.instance.openWorkbookStream("46904.xls"));
+            new HSSFWorkbook(fs.getRoot(), false);
             fail();
         } catch(OldExcelFormatException e) {
             assertTrue(e.getMessage().startsWith(
                     "The supplied spreadsheet seems to be Excel"
             ));
         }
+        // TODO Fix this to work with NPOIFS as well
+/*
+        try {
+            NPOIFSFileSystem fs = new NPOIFSFileSystem(
+                    HSSFITestDataProvider.instance.openWorkbookStream("46904.xls"));
+            new HSSFWorkbook(fs.getRoot(), false);
+            fail();
+        } catch(OldExcelFormatException e) {
+            assertTrue(e.getMessage().startsWith(
+                    "The supplied spreadsheet seems to be Excel"
+            ));
+        }
+*/
     }
 
     /**



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


Mime
View raw message