Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.xslf.usermodel
Class XSLFPictureData

    java.lang.Object
      org.apache.poi.POIXMLDocumentPart
          org.apache.poi.xslf.usermodel.XSLFPictureData

All Implemented Interfaces:
  PictureData

    @Beta
    public final class XSLFPictureData

extends POIXMLDocumentPart
implements PictureData

Instantiates sub-classes of POIXMLDocumentPart depending on their relationship type

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.poi.POIXMLDocumentPart
`POIXMLDocumentPart.RelationPart`

Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.PictureData
`PictureData.PictureType`

Constructor Summary
`protected` | `XSLFPictureData()` Create a new XSLFGraphicData node
`` | `XSLFPictureData(PackagePart part)` Construct XSLFPictureData from a package part

Method Summary
`protected void` | `cacheProperties()` Determine and cache image properties
`byte[]` | `getChecksum()` Gets the checksum - the checksum can be of various length - mostly it's 8 (XSLF) or 16 (HSLF) bytes long.
`java.lang.String` | `getContentType()` Returns content type (mime type) of this picture.
`byte[]` | `getData()` Gets the picture data as a byte array.
`java.lang.String` | `getFileName()` Returns the file name of the image, eg image7.jpg .
`java.awt.Dimension` | `getImageDimension()` Return the original image dimensions in points (for formats supported by BufferedImage).
`java.awt.Dimension` | `getImageDimensionInPixels()` Return the original image dimensions in pixels
`int` | `getIndex()`
`java.io.InputStream` | `getInputStream()` An InputStream to read the picture data directly from the underlying package part
`PictureData.PictureType` | `getType()`
`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.
`void` | `setData(byte[] data)` Sets the binary picture data
`void` | `setIndex(int index)`
`java.lang.String` | `suggestFileExtension()` Suggests a file extension for this image.

Methods inherited from class org.apache.poi.POIXMLDocumentPart
`_invokeOnDocumentRead, addRelation, commit, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationParts, getRelations, getTargetPart, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### XSLFPictureData

    protected XSLFPictureData()

  Create a new XSLFGraphicData node

### XSLFPictureData

    public XSLFPictureData(PackagePart part)

  Construct XSLFPictureData from a package part

  Parameters:
    `part` - the package part holding the drawing data
  Since:
    POI 3.14-Beta1

Method Detail

### getInputStream

    public java.io.InputStream getInputStream()
                                       throws java.io.IOException

  An InputStream to read the picture data directly from the underlying package part

  Returns:
    InputStream
  Throws:
    `java.io.IOException`

### getData

    public byte[] getData()

  Gets the picture data as a byte array. You can grab the picture data directly from the underlying package part with the `getInputStream()` method

  Specified by:
    `getData` in interface `PictureData`
  Returns:
    the Picture data.

### getFileName

    public java.lang.String getFileName()

  Returns the file name of the image, eg image7.jpg . The original filename isn't always available, but if it can be found it's likely to be in the CTDrawing

### suggestFileExtension

    public java.lang.String suggestFileExtension()

  Suggests a file extension for this image.

  Returns:
    the file extension.

### getChecksum

    public byte[] getChecksum()

  Description copied from interface: `PictureData`
  Gets the checksum - the checksum can be of various length - mostly it's 8 (XSLF) or 16 (HSLF) bytes long.

  Specified by:
    `getChecksum` in interface `PictureData`
  Returns:
    the checksum

### getImageDimension

    public java.awt.Dimension getImageDimension()

  Description copied from interface: `PictureData`
  Return the original image dimensions in points (for formats supported by BufferedImage). Will return a Dimension with a default width of 200x200 if the format unsupported.

  Specified by:
    `getImageDimension` in interface `PictureData`

### getImageDimensionInPixels

    public java.awt.Dimension getImageDimensionInPixels()

  Description copied from interface: `PictureData`
  Return the original image dimensions in pixels

  Specified by:
    `getImageDimensionInPixels` in interface `PictureData`
  See Also:
    `PictureData.getImageDimension()`

### cacheProperties

    protected void cacheProperties()

  Determine and cache image properties

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

### getContentType

    public java.lang.String getContentType()

  Description copied from interface: `PictureData`
  Returns content type (mime type) of this picture.

  Specified by:
    `getContentType` in interface `PictureData`
  Returns:
    content type of this picture.

### setData

    public void setData(byte[] data)
                 throws java.io.IOException

  Description copied from interface: `PictureData`
  Sets the binary picture data

  Specified by:
    `setData` in interface `PictureData`
  Parameters:
    `data` - picture data
  Throws:
    `java.io.IOException`

### getType

    public PictureData.PictureType getType()

  Specified by:
    `getType` in interface `PictureData`
  Returns:
    the picture type

### getIndex

    public int getIndex()

  Returns:
    the 0-based index of this pictures within the picture parts

### setIndex

    public void setIndex(int index)

  Parameters:
    `index` - sets the 0-based index of this pictures within the picture parts

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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