aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2015-05-11 18:59:10 +0000
committerNick Burch <nick@apache.org>2015-05-11 18:59:10 +0000
commit5abd6431a28c8c8ff27f3a80d989deb41d77ea32 (patch)
tree07508cd5427a38f13dc1575c0760401d6e080606 /src/scratchpad
parentdd8090c1c476b59ea34b91a9015d5f7ec882e6c4 (diff)
downloadpoi-5abd6431a28c8c8ff27f3a80d989deb41d77ea32.tar.gz
poi-5abd6431a28c8c8ff27f3a80d989deb41d77ea32.zip
#56791 More updates from OPOIFS to NPOIFS
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1678801 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
-rw-r--r--src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java6
-rw-r--r--src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java2
-rw-r--r--src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java11
-rw-r--r--src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java8
-rw-r--r--src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java6
-rw-r--r--src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java4
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java18
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java7
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java34
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java13
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java14
11 files changed, 39 insertions, 84 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java b/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java
index ed5e700d06..40a8a7b31e 100644
--- a/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java
+++ b/src/scratchpad/src/org/apache/poi/hdgf/dev/VSDDumper.java
@@ -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.Pointer;
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]);
diff --git a/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java b/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
index 0290d59135..d37a28eb2a 100644
--- a/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
+++ b/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
@@ -62,7 +62,7 @@ public final class VisioTextExtractor extends POIOLE2TextExtractor {
this(new HDGFDiagram(dir, fs));
}
public VisioTextExtractor(InputStream inp) throws IOException {
- this(new POIFSFileSystem(inp));
+ this(new NPOIFSFileSystem(inp));
}
/**
diff --git a/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java b/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java
index 69602e7d8b..fb046c8034 100644
--- a/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java
+++ b/src/scratchpad/src/org/apache/poi/hpbf/HPBFDocument.java
@@ -51,21 +51,12 @@ public final class HPBFDocument extends POIDocument {
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);
diff --git a/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java b/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java
index df4bb15a4f..3ea5e9a35a 100644
--- a/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java
+++ b/src/scratchpad/src/org/apache/poi/hpbf/dev/HPBFDumper.java
@@ -25,7 +25,7 @@ import org.apache.poi.ddf.DefaultEscherRecordFactory;
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 {
diff --git a/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java b/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java
index c6bfca93b9..7625a08b85 100644
--- a/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java
+++ b/src/scratchpad/src/org/apache/poi/hpbf/dev/PLCDumper.java
@@ -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 {
diff --git a/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java b/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java
index be238b6f30..2295f235f5 100644
--- a/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java
+++ b/src/scratchpad/src/org/apache/poi/hpbf/extractor/PublisherTextExtractor.java
@@ -53,10 +53,6 @@ public final class PublisherTextExtractor extends POIOLE2TextExtractor {
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
diff --git a/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
index 5097ea39c0..f5ac0c3b16 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java
@@ -123,7 +123,7 @@ public final class HSLFSlideShow extends POIDocument {
*/
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 POIDocument {
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
diff --git a/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java b/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java
index 0b57552619..dad74ffa6e 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/dev/PPTXMLDump.java
@@ -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);
diff --git a/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java b/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java
index 9cb1a45a55..5e122d94ef 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/dev/SlideShowDumper.java
@@ -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();
}
diff --git a/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java b/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
index d96e2243d1..908bb44e93 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/extractor/PowerPointExtractor.java
@@ -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 extends POIOLE2TextExtractor {
* @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 extends POIOLE2TextExtractor {
* @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 extends POIOLE2TextExtractor {
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
*
diff --git a/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java b/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
index e449a555e8..45ca0ce631 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/extractor/QuickButCruddyTextExtractor.java
@@ -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.TextBytesAtom;
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 QuickButCruddyTextExtractor {
* @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 QuickButCruddyTextExtractor {
* @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 QuickButCruddyTextExtractor {
* 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