public class XWPFPictureData extends POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
Modifier and Type | Field and Description |
---|---|
protected static POIXMLRelation[] |
RELATIONS
Relationships for each known picture type
(每种已知图片类型的关系)
|
Modifier | Constructor and Description |
---|---|
protected |
XWPFPictureData()
Create a new XWPFGraphicData node
(创建一个新的 XWPFGraphicData 节点)
|
|
XWPFPictureData(PackagePart part)
Construct XWPFPictureData from a package part
(从包部件构造 XWPFPitureData)
|
Modifier and Type | Method and Description |
---|---|
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 .
(返回图像的文件名,例如 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.
(*PictureData 对象直接将实际内容存储在部件中,而不像所有其他对象一样保留副本,因此我们需要以不同方式处理它们。)
|
java.lang.String |
suggestFileExtension()
Suggests a file extension for this image.
(建议此图像的文件扩展名。)
|
_invokeOnDocumentRead, addRelation, commit, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
protected static final POIXMLRelation[] RELATIONS
protected XWPFPictureData()
public XWPFPictureData(PackagePart part)
part
- the package part holding the drawing data,
(part - 包含绘图数据的包部分,)
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 read
(java.io.IOException - 读取文档时子类可能会抛出 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 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
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.