|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.poi.openxml4j.opc.internal.ContentTypeManager
public abstract class ContentTypeManager
Manage package content types ([Content_Types].xml part).
Field Summary | |
---|---|
protected Package |
container
Reference to the package using this content type manager. |
static java.lang.String |
CONTENT_TYPES_PART_NAME
Content type part name. |
protected static org.apache.log4j.Logger |
logger
|
static java.lang.String |
TYPES_NAMESPACE_URI
Content type namespace |
Constructor Summary | |
---|---|
ContentTypeManager(java.io.InputStream in,
Package pkg)
Constructor. |
Method Summary | |
---|---|
void |
addContentType(PackagePartName partName,
java.lang.String contentType)
Build association extention-> content type (will be stored in [Content_Types].xml) for example ContentType="image/png" Extension="png" [M2.8]: When adding a new part to a package, the package implementer shall ensure that a content type for that part is specified in the Content Types stream; the package implementer shall perform the steps described in��9.1.2.3: 1. |
void |
clearAll()
Clear all content types. |
void |
clearOverrideContentTypes()
Clear all override content types. |
java.lang.String |
getContentType(PackagePartName partName)
Get the content type for the specified part, if any. |
boolean |
isContentTypeRegister(java.lang.String contentType)
Check if the specified content type is already register. |
void |
removeContentType(PackagePartName partName)
Delete a content type based on the specified part name. |
boolean |
save(java.io.OutputStream outStream)
Save the contents type part. |
abstract boolean |
saveImpl(org.dom4j.Document content,
java.io.OutputStream out)
Specific implementation of the save method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.apache.log4j.Logger logger
protected Package container
public static final java.lang.String CONTENT_TYPES_PART_NAME
public static final java.lang.String TYPES_NAMESPACE_URI
Constructor Detail |
---|
public ContentTypeManager(java.io.InputStream in, Package pkg) throws InvalidFormatException
archive
- If different of null then the content types part is
retrieve and parse.
InvalidFormatException
- If the content types part content is not valid.Method Detail |
---|
public void addContentType(PackagePartName partName, java.lang.String contentType)
partUri
- the uri that will be storedpublic void removeContentType(PackagePartName partName) throws InvalidOperationException
partUri
- The part URI associated with the override content type to
delete.
InvalidOperationException
- Throws ifpublic boolean isContentTypeRegister(java.lang.String contentType)
contentType
- The content type to check.
true
if the specified content type is already
register, then false
.public java.lang.String getContentType(PackagePartName partName)
partUri
- The URI part to check.
null
.
OpenXML4JRuntimeException
- Throws if the content type manager is not able to find the
content from an existing part.public void clearAll()
public void clearOverrideContentTypes()
public boolean save(java.io.OutputStream outStream)
outStream
- The output stream use to save the XML content of the content
types part.
public abstract boolean saveImpl(org.dom4j.Document content, java.io.OutputStream out)
out
- The output stream use to write the content type XML.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |