public class XWPFPictureData extends POIXMLDocumentPart
Modifier and Type | Field and Description |
---|---|
protected static POIXMLRelation[] |
RELATIONS
Relationships for each known picture type
|
DEFAULT_XML_OPTIONS
Modifier | Constructor and Description |
---|---|
protected |
XWPFPictureData()
Create a new XWPFGraphicData node
|
|
XWPFPictureData(PackagePart part,
PackageRelationship rel)
Construct XWPFPictureData from a package part
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Long |
getChecksum() |
byte[] |
getData()
Gets the picture data as a byte array.
|
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
|
String |
suggestFileExtension()
Suggests a file extension for this image.
|
addRelation, clearMemoryPackagePart, commit, createRelationship, createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelationById, getRelationCounter, getRelationId, getRelations, getTargetPart, onDocumentCreate, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, toString
protected static final POIXMLRelation[] RELATIONS
protected XWPFPictureData()
public XWPFPictureData(PackagePart part, PackageRelationship rel)
part
- the package part holding the drawing data,rel
- the package relationship holding this drawing,
the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/imageprotected void onDocumentRead() throws IOException
POIXMLDocumentPart
onDocumentRead
in class POIXMLDocumentPart
IOException
public 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 String getFileName()
public 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 Long getChecksum()
Copyright © 2020. All rights reserved.