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
public class XSSFPictureData extends POIXMLDocumentPart implements 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
Fields Modifier and Type Field Description protected static POIXMLRelation[]RELATIONSRelationships for each known picture type
-
Constructor Summary
Constructors Modifier Constructor Description protectedXSSFPictureData()Create a new XSSFPictureData nodeprotectedXSSFPictureData(PackagePart part)Construct XSSFPictureData from a package part
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getData()Gets the picture data as a byte array.static intgetMaxImageSize()StringgetMimeType()intgetPictureType()protected voidprepareForCommit()*PictureData objects store the actual content in the part directly without keeping a copy like all others therefore we need to handle them differently.static voidsetMaxImageSize(int length)StringsuggestFileExtension()-
Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_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
-
-
-
-
Field Detail
-
RELATIONS
protected static final POIXMLRelation[] RELATIONS
Relationships for each known picture type
-
-
Constructor Detail
-
XSSFPictureData
protected XSSFPictureData()
Create a new XSSFPictureData node- See Also:
XSSFWorkbook.addPicture(byte[], int)
-
XSSFPictureData
protected XSSFPictureData(PackagePart part)
Construct XSSFPictureData from a package part- Parameters:
part- the package part holding the drawing data,- Since:
- POI 3.14-Beta1
-
-
Method Detail
-
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
public String suggestFileExtension()
- Specified by:
suggestFileExtensionin interfacePictureData
-
getPictureType
public int getPictureType()
- Specified by:
getPictureTypein interfacePictureData
-
getMimeType
public String getMimeType()
- Specified by:
getMimeTypein 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:
prepareForCommitin classPOIXMLDocumentPart
-
-