Class XWPFPictureData


  • public class XWPFPictureData
    extends org.apache.poi.ooxml.POIXMLDocumentPart
    Raw picture data, normally attached to a WordprocessingML Drawing. As a rule, pictures are stored in the /word/media/ part of a WordprocessingML package.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart

        org.apache.poi.ooxml.POIXMLDocumentPart.RelationPart
    • Constructor Summary

      Constructors 
      Constructor Description
      XWPFPictureData​(PackagePart part)
      Construct XWPFPictureData from a package part
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.Long getChecksum()  
      byte[] getData()
      Gets the picture data as a byte array.
      java.lang.String getFileName()
      Returns the file name of the image, eg image7.jpg .
      int getPictureType()
      Return an integer constant that specifies type of this picture
      int hashCode()  
      java.lang.String suggestFileExtension()
      Suggests a file extension for this image.
      • Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart

        _invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, isCommited, isCommitted, setCommited, setCommitted, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • XWPFPictureData

        public XWPFPictureData​(PackagePart part)
        Construct XWPFPictureData 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();

        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 java.lang.Long getChecksum()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object