|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.poi.POIXMLDocumentPart
org.apache.poi.POIXMLDocument
public abstract class POIXMLDocument
This holds the common functionality for all POI OOXML Document classes.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.poi.POIXMLDocumentPart |
---|
POIXMLDocumentPart.RelationPart |
Field Summary | |
---|---|
static java.lang.String |
DOCUMENT_CREATOR
|
static java.lang.String |
OLE_OBJECT_REL_TYPE
|
static java.lang.String |
PACK_OBJECT_REL_TYPE
|
Constructor Summary | |
---|---|
protected |
POIXMLDocument(OPCPackage pkg)
|
protected |
POIXMLDocument(OPCPackage pkg,
java.lang.String coreDocumentRel)
|
Method Summary | |
---|---|
void |
close()
Closes the underlying OPCPackage from which this
document was read, if there is one |
abstract java.util.List<PackagePart> |
getAllEmbedds()
Get the document's embedded files. |
protected PackagePart |
getCorePart()
|
OPCPackage |
getPackage()
Get the assigned OPCPackage |
POIXMLProperties |
getProperties()
Get the document properties. |
protected PackagePart[] |
getRelatedByType(java.lang.String contentType)
Retrieves all the PackageParts which are defined as relationships of the base document with the specified content type. |
protected void |
load(POIXMLFactory factory)
|
static OPCPackage |
openPackage(java.lang.String path)
Wrapper to open a package, which works around shortcomings in java's this() constructor calls |
void |
write(java.io.OutputStream stream)
Write out this document to an Outputstream. |
Methods inherited from class org.apache.poi.POIXMLDocumentPart |
---|
_invokeOnDocumentRead, addRelation, commit, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationParts, getRelations, getTargetPart, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DOCUMENT_CREATOR
public static final java.lang.String OLE_OBJECT_REL_TYPE
public static final java.lang.String PACK_OBJECT_REL_TYPE
Constructor Detail |
---|
protected POIXMLDocument(OPCPackage pkg)
protected POIXMLDocument(OPCPackage pkg, java.lang.String coreDocumentRel)
Method Detail |
---|
public static OPCPackage openPackage(java.lang.String path) throws java.io.IOException
path
- the path to the document
java.io.IOException
- if there was a problem opening the documentpublic OPCPackage getPackage()
protected PackagePart getCorePart()
protected PackagePart[] getRelatedByType(java.lang.String contentType) throws InvalidFormatException
contentType
- the content type
InvalidFormatException
- when the relationships or the parts contain errorsXSSFRelation
,
XSLFRelation
,
XWPFRelation
,
XDGFRelation
public POIXMLProperties getProperties()
public abstract java.util.List<PackagePart> getAllEmbedds() throws OpenXML4JException
OpenXML4JException
- if the embedded parts can't be determinedprotected final void load(POIXMLFactory factory) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
OPCPackage
from which this
document was read, if there is one
Once this has been called, no further operations, updates or reads should be performed on the document.
close
in interface java.io.Closeable
java.io.IOException
- for writable packages, if an IO exception occur during the saving process.public final void write(java.io.OutputStream stream) throws java.io.IOException
File
rather
than an InputStream
, you must write out to
a different file, overwriting 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.
stream
- - the java OutputStream you wish to write the file to
java.io.IOException
- if anything can't be written.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |