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 and Description
    --- | ---
    `protected static POIXMLRelation[]` | `RELATIONS` Relationships for each known picture type

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `XSSFPictureData()` Create a new XSSFPictureData node
    `protected` | `XSSFPictureData(PackagePart part)` Construct XSSFPictureData from a package part

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getData()` Gets the picture data as a byte array.
    `java.lang.String` | `getMimeType()` Returns the mime type for the image
    `int` | `getPictureType()` Return an integer constant that specifies type of this picture
    `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.
    `java.lang.String` | `suggestFileExtension()` 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, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, removeRelation, setCommited, setCommitted, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 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

    - #### 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 `PictureData`
      Returns:
        the picture data.

    - #### suggestFileExtension

          public java.lang.String suggestFileExtension()

      Suggests a file extension for this image.
      Specified by:
        `suggestFileExtension` in interface `PictureData`
      Returns:
        the file extension.

    - #### getPictureType

          public int getPictureType()

      Return an integer constant that specifies type of this picture
      Specified by:
        `getPictureType` in interface `PictureData`
      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()

      Description copied from interface: `PictureData`
      Returns the mime type for the image
      Specified by:
        `getMimeType` in interface `PictureData`

    - #### 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 class `POIXMLDocumentPart`

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.