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 -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getData()Gets the picture data as a byte array.static intReturns the mime type for the imageintstatic voidsetMaxImageSize(int length) Suggests a file extension for this image.Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, isCommitted, setCommitted, toString
-
Method Details
-
setMaxImageSize
public static void setMaxImageSize(int length) - Parameters:
length- the max image size allowed for XSSF pictures
-
getMaxImageSize
public static int getMaxImageSize()- Returns:
- the max image size allowed for XSSF pictures
-
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:
getDatain interfacePictureData- Returns:
- the picture data.
-
suggestFileExtension
Description copied from interface:PictureDataSuggests a file extension for this image.- Specified by:
suggestFileExtensionin interfacePictureData- Returns:
- the file extension, without a leading
.. Nevernull, but will be empty if the extension is unknown or if the file backing these data does not have an extension.
-
getPictureType
public int getPictureType()- Specified by:
getPictureTypein interfacePictureData- Returns:
- the POI internal image type,
0if unknown image type - See Also:
-
getMimeType
Description copied from interface:PictureDataReturns the mime type for the image- Specified by:
getMimeTypein interfacePictureData
-