Class HSLFPictureData

  • All Implemented Interfaces:
    PictureData
    Direct Known Subclasses:
    Bitmap, Metafile

    public abstract class HSLFPictureData
    extends java.lang.Object
    implements PictureData
    A class that represents image data contained in a slide show.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int CHECKSUM_SIZE
      Size of the image checksum calculated using MD5 algorithm.
    • Constructor Summary

      Constructors 
      Constructor Description
      HSLFPictureData()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static HSLFPictureData create​(PictureData.PictureType type)
      Create an instance of PictureData by type.
      byte[] getChecksum()
      Gets the checksum - the checksum can be of various length - mostly it's 8 (XSLF) or 16 (HSLF) bytes long.
      static byte[] getChecksum​(byte[] data)
      Compute 16-byte checksum of this picture using MD5 algorithm.
      java.lang.String getContentType()
      Returns content type (mime type) of this picture.
      byte[] getHeader()
      Return 24 byte header which preceeds the actual picture data.
      java.awt.Dimension getImageDimensionInPixels()
      Return the original image dimensions in pixels
      int getIndex()  
      int getOffset()
      File offset in the 'Pictures' stream
      byte[] getRawData()
      Returns the raw binary data of this Picture excluding the first 8 bytes which hold image signature and size of the image data.
      protected abstract int getSignature()
      Blip signature.
      byte[] getUID()
      Returns 16-byte checksum of this picture
      protected int getUIDInstanceCount()
      The instance type/signatures defines if one or two UID instances will be included
      void setIndex​(int index)  
      void setOffset​(int offset)
      Set offset of this picture in the 'Pictures' stream.
      void setRawData​(byte[] data)  
      abstract void setSignature​(int signature)  
      protected void setUIDInstanceCount​(int uidInstanceCount)
      The instance type/signatures defines if one or two UID instances will be included
      void write​(java.io.OutputStream out)
      Write this picture into OutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CHECKSUM_SIZE

        protected static final int CHECKSUM_SIZE
        Size of the image checksum calculated using MD5 algorithm.
        See Also:
        Constant Field Values
    • Constructor Detail

      • HSLFPictureData

        public HSLFPictureData()
    • Method Detail

      • getSignature

        protected abstract int getSignature()
        Blip signature.
      • setSignature

        public abstract void setSignature​(int signature)
      • getUIDInstanceCount

        protected int getUIDInstanceCount()
        The instance type/signatures defines if one or two UID instances will be included
      • setUIDInstanceCount

        protected void setUIDInstanceCount​(int uidInstanceCount)
        The instance type/signatures defines if one or two UID instances will be included
        Parameters:
        uidInstanceCount - the number of uid sequences
      • getRawData

        public byte[] getRawData()
        Returns the raw binary data of this Picture excluding the first 8 bytes which hold image signature and size of the image data.
        Returns:
        picture data
      • setRawData

        public void setRawData​(byte[] data)
      • getOffset

        public int getOffset()
        File offset in the 'Pictures' stream
        Returns:
        offset in the 'Pictures' stream
      • setOffset

        public void setOffset​(int offset)
        Set offset of this picture in the 'Pictures' stream. We need to set it when a new picture is created.
        Parameters:
        offset - in the 'Pictures' stream
      • getUID

        public byte[] getUID()
        Returns 16-byte checksum of this picture
      • 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
      • getChecksum

        public static byte[] getChecksum​(byte[] data)
        Compute 16-byte checksum of this picture using MD5 algorithm.
      • write

        public void write​(java.io.OutputStream out)
                   throws java.io.IOException
        Write this picture into OutputStream
        Throws:
        java.io.IOException
      • create

        public static HSLFPictureData create​(PictureData.PictureType type)
        Create an instance of PictureData by type.
        Parameters:
        type - type of the picture data. Must be one of the static constants defined in the Picture class.
        Returns:
        concrete instance of PictureData
      • getHeader

        public byte[] getHeader()
        Return 24 byte header which preceeds the actual picture data.

        The header consists of 2-byte signature, 2-byte type, 4-byte image size and 16-byte checksum of the image data.

        Returns:
        the 24 byte header which preceeds the actual picture data.
      • getIndex

        public int getIndex()
        Returns:
        the 1-based index of this pictures within the pictures stream
      • setIndex

        public void setIndex​(int index)
        Parameters:
        index - sets the 1-based index of this pictures within the pictures stream
      • getContentType

        public final 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.