|
||||||||||
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.xwpf.usermodel.XWPFPictureData
public class XWPFPictureData
Raw picture data, normally attached to a WordprocessingML Drawing. As a rule, pictures are stored in the /word/media/ part of a WordprocessingML package.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.poi.POIXMLDocumentPart |
---|
POIXMLDocumentPart.RelationPart |
Field Summary | |
---|---|
protected static POIXMLRelation[] |
RELATIONS
Relationships for each known picture type |
Constructor Summary | |
---|---|
protected |
XWPFPictureData()
Create a new XWPFGraphicData node |
|
XWPFPictureData(PackagePart part)
Construct XWPFPictureData from a package part |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
|
java.lang.Long |
getChecksum()
|
byte[] |
getData()
Gets the picture data as a byte array. |
java.lang.String |
getFileName()
Returns the file name of the image, eg image7.jpg . |
int |
getPictureType()
Return an integer constant that specifies type of this picture |
int |
hashCode()
|
protected void |
onDocumentRead()
Fired when a package part is read |
protected void |
prepareForCommit()
*PictureData objects store the actual content in the part directly without keeping a copy like all others therefore we need to handle them differently. |
java.lang.String |
suggestFileExtension()
Suggests a file extension for this image. |
Methods inherited from class org.apache.poi.POIXMLDocumentPart |
---|
_invokeOnDocumentRead, addRelation, commit, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationParts, getRelations, getTargetPart, onDocumentCreate, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final POIXMLRelation[] RELATIONS
Constructor Detail |
---|
protected XWPFPictureData()
public XWPFPictureData(PackagePart part)
part
- the package part holding the drawing data,Method Detail |
---|
protected void onDocumentRead() throws java.io.IOException
POIXMLDocumentPart
onDocumentRead
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException when a document is readpublic byte[] getData()
Note, that this call might be expensive since all the picture data is copied into a temporary byte array.
You can grab the picture data directly from the underlying package part as follows:
InputStream is = getPackagePart().getInputStream();
public java.lang.String getFileName()
public java.lang.String suggestFileExtension()
public int getPictureType()
Document.PICTURE_TYPE_EMF
,
Document.PICTURE_TYPE_WMF
,
Document.PICTURE_TYPE_PICT
,
Document.PICTURE_TYPE_JPEG
,
Document.PICTURE_TYPE_PNG
,
Document.PICTURE_TYPE_DIB
public java.lang.Long getChecksum()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected void prepareForCommit()
prepareForCommit
in class POIXMLDocumentPart
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |