|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.poi.POIDocument
public abstract class POIDocument
This holds the common functionality for all POI Document classes. Currently, this relates to Document Information Properties
Constructor Summary | |
---|---|
protected |
POIDocument(DirectoryNode dir)
Constructs a POIDocument with the given directory node. |
protected |
POIDocument(NPOIFSFileSystem fs)
Constructs from an old-style OPOIFS |
protected |
POIDocument(OPOIFSFileSystem fs)
Constructs from an old-style OPOIFS |
protected |
POIDocument(POIFSFileSystem fs)
Constructs from the default POIFS |
Method Summary | |
---|---|
protected void |
clearDirectory()
Clear/unlink the attached directory entry |
void |
close()
Closes the underlying NPOIFSFileSystem from which
the document was read, if any. |
void |
createInformationProperties()
Will create whichever of SummaryInformation and DocumentSummaryInformation (HPSF) properties are not already part of your document. |
DirectoryNode |
getDirectory()
|
DocumentSummaryInformation |
getDocumentSummaryInformation()
Fetch the Document Summary Information of the document |
protected java.lang.String |
getEncryptedPropertyStreamName()
|
EncryptionInfo |
getEncryptionInfo()
|
protected PropertySet |
getPropertySet(java.lang.String setName)
For a given named property entry, either return it or null if if it wasn't found |
protected PropertySet |
getPropertySet(java.lang.String setName,
EncryptionInfo encryptionInfo)
For a given named property entry, either return it or null if if it wasn't found |
SummaryInformation |
getSummaryInformation()
Fetch the Summary Information of the document |
protected boolean |
initDirectory()
check if we were created by POIFS otherwise create a new dummy POIFS for storing the package data |
protected void |
readProperties()
Find, and create objects for, the standard Document Information Properties (HPSF). |
protected DirectoryNode |
replaceDirectory(DirectoryNode newDirectory)
Replaces the attached directory, e.g. |
protected void |
validateInPlaceWritePossible()
Called during a write() to ensure that the Document (and
associated POIFSFileSystem ) was opened in a way compatible
with an in-place write. |
abstract void |
write()
Writes the document out to the currently open File , via the
writeable POIFSFileSystem it was opened from. |
abstract void |
write(java.io.File newFile)
Writes the document out to the specified new File . |
abstract void |
write(java.io.OutputStream out)
Writes the document out to the specified output stream. |
protected void |
writeProperties()
Writes out the updated standard Document Information Properties (HPSF) into the currently open NPOIFSFileSystem |
protected void |
writeProperties(NPOIFSFileSystem outFS)
Writes out the standard Document Information Properties (HPSF) |
protected void |
writeProperties(NPOIFSFileSystem outFS,
java.util.List<java.lang.String> writtenEntries)
Writes out the standard Document Information Properties (HPSF) |
protected void |
writePropertySet(java.lang.String name,
PropertySet set,
NPOIFSFileSystem outFS)
Writes out a given ProperySet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected POIDocument(DirectoryNode dir)
dir
- The DirectoryNode
where information is read from.protected POIDocument(OPOIFSFileSystem fs)
fs
- the filesystem the document is read fromprotected POIDocument(NPOIFSFileSystem fs)
fs
- the filesystem the document is read fromprotected POIDocument(POIFSFileSystem fs)
fs
- the filesystem the document is read fromMethod Detail |
---|
public DocumentSummaryInformation getDocumentSummaryInformation()
public SummaryInformation getSummaryInformation()
public void createInformationProperties()
protected void readProperties()
protected PropertySet getPropertySet(java.lang.String setName) throws java.io.IOException
setName
- The property to read
java.io.IOException
protected PropertySet getPropertySet(java.lang.String setName, EncryptionInfo encryptionInfo) throws java.io.IOException
setName
- The property to readencryptionInfo
- the encryption descriptor in case of cryptoAPI encryption
java.io.IOException
protected void writeProperties() throws java.io.IOException
java.io.IOException
- if an error when writing to the open
NPOIFSFileSystem
occursprotected void writeProperties(NPOIFSFileSystem outFS) throws java.io.IOException
outFS
- the POIFSFileSystem to write the properties into
java.io.IOException
- if an error when writing to the
NPOIFSFileSystem
occursprotected void writeProperties(NPOIFSFileSystem outFS, java.util.List<java.lang.String> writtenEntries) throws java.io.IOException
outFS
- the NPOIFSFileSystem to write the properties intowrittenEntries
- a list of POIFS entries to add the property names too
java.io.IOException
- if an error when writing to the
NPOIFSFileSystem
occursprotected void writePropertySet(java.lang.String name, PropertySet set, NPOIFSFileSystem outFS) throws java.io.IOException
name
- the (POIFS Level) name of the property to writeset
- the PropertySet to write outoutFS
- the NPOIFSFileSystem to write the property into
java.io.IOException
- if an error when writing to the
NPOIFSFileSystem
occursprotected void validateInPlaceWritePossible() throws java.lang.IllegalStateException
write()
to ensure that the Document (and
associated POIFSFileSystem
) was opened in a way compatible
with an in-place write.
java.lang.IllegalStateException
- if the document was opened suitablypublic abstract void write() throws java.io.IOException
File
, via the
writeable POIFSFileSystem
it was opened from.
This will fail (with an IllegalStateException
if the
document was opened read-only, opened from an InputStream
instead of a File, or if this is not the root document. For those cases,
you must use write(OutputStream)
or write(File)
to
write to a brand new document.
java.io.IOException
- thrown on errors writing to the file
java.lang.IllegalStateException
- if this isn't from a writable Filepublic abstract void write(java.io.File newFile) throws java.io.IOException
File
. If the file
exists, it will be replaced, otherwise a new one will be created
newFile
- The new File to write to.
java.io.IOException
- thrown on errors writing to the filepublic abstract void write(java.io.OutputStream out) throws java.io.IOException
File
rather
than an InputStream
, you must write out using
write()
or to a different File. Overwriting the currently
open file via an OutputStream isn't possible.
If stream
is a FileOutputStream
on a networked drive
or has a high cost/latency associated with each written byte,
consider wrapping the OutputStream in a BufferedOutputStream
to improve write performance, or use write()
/ write(File)
if possible.
out
- The stream to write to.
java.io.IOException
- thrown on errors writing to the streampublic void close() throws java.io.IOException
NPOIFSFileSystem
from which
the document was read, if any. Has no effect on documents
opened from an InputStream, or newly created ones.
Once close()
has been called, no further operations
should be called on the document.
close
in interface java.io.Closeable
java.io.IOException
@Internal public DirectoryNode getDirectory()
@Internal protected void clearDirectory()
@Internal protected boolean initDirectory()
true
if dummy directory was created, false
otherwise@Internal protected DirectoryNode replaceDirectory(DirectoryNode newDirectory)
newDirectory
- the new directory
protected java.lang.String getEncryptedPropertyStreamName()
public EncryptionInfo getEncryptionInfo() throws java.io.IOException
null
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |