@Beta public final class XSLFPictureData extends POIXMLDocumentPart implements PictureData
POIXMLDocumentPart.RelationPart
PictureData.PictureType
Modifier | Constructor and Description |
---|---|
protected |
XSLFPictureData()
Create a new XSLFGraphicData node
|
|
XSLFPictureData(PackagePart part)
Construct XSLFPictureData from a package part
|
Modifier and Type | Method and Description |
---|---|
protected void |
cacheProperties()
Determine and cache image properties
|
byte[] |
getChecksum()
Gets the checksum - the checksum can be of various length -
mostly it's 8 (XSLF) or 16 (HSLF) bytes long.
|
java.lang.String |
getContentType()
Returns content type (mime type) of this picture.
|
byte[] |
getData()
Gets the picture data as a byte array.
|
java.lang.String |
getFileName()
Returns the file name of the image, eg image7.jpg .
|
java.awt.Dimension |
getImageDimension()
Return the original image dimensions in points
(for formats supported by BufferedImage).
|
java.awt.Dimension |
getImageDimensionInPixels()
Return the original image dimensions in pixels
|
int |
getIndex() |
java.io.InputStream |
getInputStream()
An InputStream to read the picture data directly
from the underlying package part
|
static int |
getMaxImageSize() |
PictureData.PictureType |
getType() |
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.
|
void |
setData(byte[] data)
Sets the binary picture data
|
void |
setIndex(int index) |
static void |
setMaxImageSize(int length) |
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, onDocumentRead, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
protected XSLFPictureData()
public XSLFPictureData(PackagePart part)
part
- the package part holding the drawing datapublic static void setMaxImageSize(int length)
length
- the max image size allowed for XSLF picturespublic static int getMaxImageSize()
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public byte[] getData()
getInputStream()
methodgetData
in interface PictureData
public java.lang.String getFileName()
public java.lang.String suggestFileExtension()
public byte[] getChecksum()
PictureData
getChecksum
in interface PictureData
public java.awt.Dimension getImageDimension()
PictureData
getImageDimension
in interface PictureData
public java.awt.Dimension getImageDimensionInPixels()
PictureData
getImageDimensionInPixels
in interface PictureData
PictureData.getImageDimension()
protected void cacheProperties()
protected void prepareForCommit()
prepareForCommit
in class POIXMLDocumentPart
public java.lang.String getContentType()
PictureData
getContentType
in interface PictureData
public void setData(byte[] data) throws java.io.IOException
PictureData
The format of the data must match the format of PictureData.getType()
. Failure to match the picture data may result
in data loss.
setData
in interface PictureData
data
- picture datajava.io.IOException
public PictureData.PictureType getType()
getType
in interface PictureData
public int getIndex()
public void setIndex(int index)
index
- sets the 0-based index of this pictures within the picture partsCopyright 2022 The Apache Software Foundation or its licensors, as applicable.