More NPOIFS Constructor updates

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1085447 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-03-25 16:21:09 +00:00
parent 535e69dea4
commit 64185cd51c
6 changed files with 95 additions and 9 deletions

View File

@ -31,6 +31,7 @@ import org.apache.poi.hdgf.streams.StringsStream;
import org.apache.poi.hdgf.streams.TrailerStream;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.LittleEndian;
@ -56,10 +57,20 @@ public final class HDGFDiagram extends POIDocument {
private PointerFactory ptrFactory;
public HDGFDiagram(POIFSFileSystem fs) throws IOException {
this(fs.getRoot(), fs);
this(fs.getRoot());
}
public HDGFDiagram(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
super(dir, fs);
public HDGFDiagram(NPOIFSFileSystem fs) throws IOException {
this(fs.getRoot());
}
/**
* @deprecated Use {@link #HDGFDiagram(DirectoryNode)} instead
*/
@Deprecated
public HDGFDiagram(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
this(dir);
}
public HDGFDiagram(DirectoryNode dir) throws IOException {
super(dir);
DocumentEntry docProps =
(DocumentEntry)dir.getEntry("VisioDocument");

View File

@ -30,6 +30,7 @@ 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.DirectoryNode;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
@ -39,18 +40,26 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
*/
public final class VisioTextExtractor extends POIOLE2TextExtractor {
private HDGFDiagram hdgf;
private POIFSFileSystem fs;
public VisioTextExtractor(HDGFDiagram hdgf) {
super(hdgf);
this.hdgf = hdgf;
}
public VisioTextExtractor(POIFSFileSystem fs) throws IOException {
this(fs.getRoot(), fs);
this(fs.getRoot());
}
public VisioTextExtractor(NPOIFSFileSystem fs) throws IOException {
this(fs.getRoot());
}
public VisioTextExtractor(DirectoryNode dir) throws IOException {
this(new HDGFDiagram(dir));
}
/**
* @deprecated Use {@link #VisioTextExtractor(DirectoryNode)} instead
*/
@Deprecated
public VisioTextExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
this(new HDGFDiagram(dir, fs));
this.fs = fs;
}
public VisioTextExtractor(InputStream inp) throws IOException {
this(new POIFSFileSystem(inp));

View File

@ -46,6 +46,7 @@ import org.apache.poi.hslf.usermodel.PictureData;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogFactory;
@ -128,15 +129,29 @@ public final class HSLFSlideShow extends POIDocument {
this(filesystem.getRoot());
}
/**
* Constructs a Powerpoint document from a POIFS Filesystem. Parses the
* document and places all the important stuff into data structures.
*
* @param filesystem the POIFS FileSystem to read from
* @throws IOException if there is a problem while parsing the document.
*/
public HSLFSlideShow(NPOIFSFileSystem filesystem) throws IOException
{
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);

View File

@ -29,6 +29,7 @@ import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.*;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
@ -100,9 +101,32 @@ public final class PowerPointExtractor extends POIOLE2TextExtractor {
* @param fs the POIFSFileSystem containing the PowerPoint document
*/
public PowerPointExtractor(POIFSFileSystem fs) throws IOException {
this(new HSLFSlideShow(fs));
this(fs.getRoot());
}
/**
* Creates a PowerPointExtractor, from an open NPOIFSFileSystem
*
* @param fs the NPOIFSFileSystem containing the PowerPoint document
*/
public PowerPointExtractor(NPOIFSFileSystem fs) throws IOException {
this(fs.getRoot());
}
/**
* Creates a PowerPointExtractor, from a specific place
* inside an open NPOIFSFileSystem
*
* @param dir the POIFS Directory containing the PowerPoint document
*/
public PowerPointExtractor(DirectoryNode dir) throws IOException {
this(new HSLFSlideShow(dir));
}
/**
* @deprecated Use {@link #PowerPointExtractor(DirectoryNode)} instead
*/
@Deprecated
public PowerPointExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
this(new HSLFSlideShow(dir, fs));
}

View File

@ -41,6 +41,7 @@ import org.apache.poi.hsmf.datatypes.StringChunk;
import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
import org.apache.poi.hsmf.parsers.POIFSChunkParser;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
@ -92,7 +93,22 @@ public class MAPIMessage extends POIDocument {
* @throws IOException
*/
public MAPIMessage(POIFSFileSystem fs) throws IOException {
this(fs.getRoot(), fs);
this(fs.getRoot());
}
/**
* Constructor for reading MSG Files from a POIFS filesystem
* @param fs
* @throws IOException
*/
public MAPIMessage(NPOIFSFileSystem fs) throws IOException {
this(fs.getRoot());
}
/**
* @deprecated Use {@link #MAPIMessage(DirectoryNode)} instead
*/
@Deprecated
public MAPIMessage(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException {
this(poifsDir);
}
/**
* Constructor for reading MSG Files from a certain
@ -101,7 +117,7 @@ public class MAPIMessage extends POIDocument {
* @param fs
* @throws IOException
*/
public MAPIMessage(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException {
public MAPIMessage(DirectoryNode poifsDir) throws IOException {
super(poifsDir);
// Grab all the chunks

View File

@ -25,6 +25,7 @@ import org.apache.poi.hsmf.MAPIMessage;
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.StringUtil.StringsIterator;
@ -36,12 +37,22 @@ public class OutlookTextExtactor extends POIOLE2TextExtractor {
public OutlookTextExtactor(MAPIMessage msg) {
super(msg);
}
/**
* Use {@link #OutlookTextExtactor(DirectoryNode)} instead
*/
@Deprecated
public OutlookTextExtactor(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException {
this(new MAPIMessage(poifsDir, fs));
}
public OutlookTextExtactor(DirectoryNode poifsDir) throws IOException {
this(new MAPIMessage(poifsDir));
}
public OutlookTextExtactor(POIFSFileSystem fs) throws IOException {
this(new MAPIMessage(fs));
}
public OutlookTextExtactor(NPOIFSFileSystem fs) throws IOException {
this(new MAPIMessage(fs));
}
public OutlookTextExtactor(InputStream inp) throws IOException {
this(new MAPIMessage(inp));
}