org.apache.poi.xssf.usermodel
Class XSSFPictureData

java.lang.Object
  extended by org.apache.poi.POIXMLDocumentPart
      extended by org.apache.poi.xssf.usermodel.XSSFPictureData
All Implemented Interfaces:
org.apache.poi.ss.usermodel.PictureData

public class XSSFPictureData
extends POIXMLDocumentPart
implements org.apache.poi.ss.usermodel.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.


Field Summary
 
Fields inherited from class org.apache.poi.POIXMLDocumentPart
DEFAULT_XML_OPTIONS
 
Method Summary
 byte[] getData()
          Gets the picture data as a byte array.
 java.lang.String getMimeType()
           
 int getPictureType()
          Return an integer constant that specifies type of this picture
 java.lang.String suggestFileExtension()
          Suggests a file extension for this image.
 
Methods inherited from class org.apache.poi.POIXMLDocumentPart
createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelations, removeRelation, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

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 interface org.apache.poi.ss.usermodel.PictureData
Returns:
the picture data.

suggestFileExtension

public java.lang.String suggestFileExtension()
Suggests a file extension for this image.

Specified by:
suggestFileExtension in interface org.apache.poi.ss.usermodel.PictureData
Returns:
the file extension.

getPictureType

public int getPictureType()
Return an integer constant that specifies type of this picture

Returns:
an integer constant that specifies type of this picture
See Also:
Workbook.PICTURE_TYPE_EMF, Workbook.PICTURE_TYPE_WMF, Workbook.PICTURE_TYPE_PICT, Workbook.PICTURE_TYPE_JPEG, Workbook.PICTURE_TYPE_PNG, Workbook.PICTURE_TYPE_DIB

getMimeType

public java.lang.String getMimeType()
Specified by:
getMimeType in interface org.apache.poi.ss.usermodel.PictureData