Package org.apache.poi.xssf.usermodel
Class XSSFPictureData
java.lang.Object
org.apache.poi.ooxml.POIXMLDocumentPart
org.apache.poi.xssf.usermodel.XSSFPictureData
- All Implemented Interfaces:
PictureData
Raw picture data, normally attached to a SpreadsheetML Drawing.
As a rule, pictures are stored in the /xl/media/ part of a SpreadsheetML package.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final POIXMLRelation[]
Relationships for each known picture type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Create a new XSSFPictureData nodeprotected
XSSFPictureData
(PackagePart part) Construct XSSFPictureData from a package part -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
getData()
Gets the picture data as a byte array.Returns the mime type for the imageint
Return an integer constant that specifies type of this pictureprotected void
*PictureData objects store the actual content in the part directly without keeping a copy like all others therefore we need to handle them differently.Suggests a file extension for this image.Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, commit, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommited, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, removeRelation, setCommited, toString
-
Field Details
-
RELATIONS
Relationships for each known picture type
-
-
Constructor Details
-
XSSFPictureData
protected XSSFPictureData()Create a new XSSFPictureData node- See Also:
-
XSSFPictureData
Construct XSSFPictureData from a package part- Parameters:
part
- the package part holding the drawing data,- Since:
- POI 3.14-Beta1
-
-
Method Details
-
getData
public byte[] getData()Gets the picture data as a byte array.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();
- Specified by:
getData
in interfacePictureData
- Returns:
- the picture data.
-
suggestFileExtension
Suggests a file extension for this image.- Specified by:
suggestFileExtension
in interfacePictureData
- Returns:
- the file extension.
-
getPictureType
public int getPictureType()Return an integer constant that specifies type of this picture- Specified by:
getPictureType
in interfacePictureData
- Returns:
- an integer constant that specifies type of this picture
- See Also:
-
getMimeType
Description copied from interface:PictureData
Returns the mime type for the image- Specified by:
getMimeType
in interfacePictureData
-
prepareForCommit
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.- Overrides:
prepareForCommit
in classPOIXMLDocumentPart
-