/* Have the property streams been read yet? (Only done on-demand) */
private boolean initialized = false;
-
+ /**
+ * Constructs a POIDocument with the given directory node.
+ *
+ * @param dir The {@link DirectoryNode} where information is read from.
+ */
protected POIDocument(DirectoryNode dir) {
this.directory = dir;
}
+
/**
* @deprecated use {@link POIDocument#POIDocument(DirectoryNode)} instead
*/
protected POIDocument(DirectoryNode dir, POIFSFileSystem fs) {
this.directory = dir;
}
+
protected POIDocument(POIFSFileSystem fs) {
this(fs.getRoot());
}
+
protected POIDocument(NPOIFSFileSystem fs) {
this(fs.getRoot());
}
/**
* Fetch the Document Summary Information of the document
+ *
+ * @return The Document Summary Information or null
+ * if it could not be read for this document.
*/
public DocumentSummaryInformation getDocumentSummaryInformation() {
if(!initialized) readProperties();
/**
* Fetch the Summary Information of the document
+ *
+ * @return The Summary information for the document or null
+ * if it could not be read for this document.
*/
public SummaryInformation getSummaryInformation() {
if(!initialized) readProperties();
/**
* Find, and create objects for, the standard
- * Documment Information Properties (HPSF).
+ * Document Information Properties (HPSF).
* If a given property set is missing or corrupt,
* it will remain null;
*/
/**
* For a given named property entry, either return it or null if
* if it wasn't found
+ *
+ * @param setName The property to read
+ * @return The value of the given property or null if it wasn't found.
*/
protected PropertySet getPropertySet(String setName) {
//directory can be null when creating new documents
/**
* Writes out the standard Documment Information Properties (HPSF)
* @param outFS the POIFSFileSystem to write the properties into
+ *
+ * @throws IOException if an error when writing to the
+ * {@link POIFSFileSystem} occurs
*/
protected void writeProperties(POIFSFileSystem outFS) throws IOException {
writeProperties(outFS, null);
* Writes out the standard Documment Information Properties (HPSF)
* @param outFS the POIFSFileSystem to write the properties into
* @param writtenEntries a list of POIFS entries to add the property names too
+ *
+ * @throws IOException if an error when writing to the
+ * {@link POIFSFileSystem} occurs
*/
protected void writeProperties(POIFSFileSystem outFS, List<String> writtenEntries) throws IOException {
SummaryInformation si = getSummaryInformation();
* @param name the (POIFS Level) name of the property to write
* @param set the PropertySet to write out
* @param outFS the POIFSFileSystem to write the property into
+ *
+ * @throws IOException if an error when writing to the
+ * {@link POIFSFileSystem} occurs
*/
protected void writePropertySet(String name, PropertySet set, POIFSFileSystem outFS) throws IOException {
try {
}
/**
- * Writes the document out to the specified output stream
+ * Writes the document out to the specified output stream. The
+ * stream is not closed as part of this operation.
+ *
+ * @param out The stream to write to.
+ *
+ * @throws IOException thrown on errors writing to the stream
*/
public abstract void write(OutputStream out) throws IOException;
* @param source is the source POIFS to copy from
* @param target is the target POIFS to copy to
* @param excepts is a list of Strings specifying what nodes NOT to copy
+ *
+ * @throws IOException thrown on errors writing to the target file system.
+ *
* @deprecated Use {@link EntryUtils#copyNodes(DirectoryEntry, DirectoryEntry, List)} instead
*/
@Deprecated
* @param sourceRoot is the source POIFS to copy from
* @param targetRoot is the target POIFS to copy to
* @param excepts is a list of Strings specifying what nodes NOT to copy
+ *
+ * @throws IOException thrown on errors writing to the target directory node.
+ *
* @deprecated Use {@link EntryUtils#copyNodes(DirectoryEntry, DirectoryEntry, List)} instead
*/
@Deprecated
/**
* Copies an Entry into a target POIFS directory, recursively
+ *
+ * @param entry the entry to copy from
+ * @param target the entry to write to
+ *
+ * @throws IOException thrown on errors writing to the target directory entry.
+ *
* @deprecated Use {@link EntryUtils#copyNodeRecursively(Entry, DirectoryEntry)} instead
*/
@Internal
public abstract class POIOLE2TextExtractor extends POITextExtractor {
/**
* Creates a new text extractor for the given document
+ *
+ * @param The POIDocument to use in this extractor.
*/
public POIOLE2TextExtractor(POIDocument document) {
super(document);
/**
* Returns the document information metadata for the document
+ *
+ * @return The Document Summary Information or null
+ * if it could not be read for this document.
*/
public DocumentSummaryInformation getDocSummaryInformation() {
return document.getDocumentSummaryInformation();
}
/**
- * Returns the summary information metadata for the document
+ * Returns the summary information metadata for the document.
+ *
+ * @return The Summary information for the document or null
+ * if it could not be read for this document.
*/
public SummaryInformation getSummaryInformation() {
return document.getSummaryInformation();
/**
* Returns an HPSF powered text extractor for the
* document properties metadata, such as title and author.
+ *
+ * @return an instance of POIExtractor that can extract meta-data.
*/
public POITextExtractor getMetadataTextExtractor() {
return new HPSFPropertiesExtractor(this);
}
+ /**
+ * Return the underlying DirectoryEntry of this document.
+ *
+ * @return the DirectoryEntry that is associated with the POIDocument of this extractor.
+ */
public DirectoryEntry getRoot()
{
return document.directory;
/**
* Return the underlying POIFS FileSystem of this document.
+ *
+ * @return the POIFSFileSystem that is associated with the POIDocument of this extractor.
*
* @deprecated Use {@link #getRoot()} instead
*/