Package org.apache.poi.hslf.usermodel
Class HSLFPictureData
- java.lang.Object
-
- org.apache.poi.hslf.usermodel.HSLFPictureData
-
- All Implemented Interfaces:
GenericRecord,PictureData
public abstract class HSLFPictureData extends Object implements PictureData, GenericRecord
A class that represents image data contained in a slide show.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.poi.sl.usermodel.PictureData
PictureData.PictureType
-
-
Field Summary
Fields Modifier and Type Field Description protected static intCHECKSUM_SIZESize of the image checksum calculated using MD5 algorithm.
-
Constructor Summary
Constructors Modifier Constructor Description HSLFPictureData()Deprecated.UseHSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)or one of its overloads to create newHSLFPictureData.protectedHSLFPictureData(EscherContainerRecord bStore, EscherBSERecord bse)Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static HSLFPictureDatacreate(PictureData.PictureType type)Deprecated.UseHSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)or one of its overloads to create newHSLFPictureData.protected abstract byte[]formatImageForSlideshow(byte[] data)Formats the picture data for storage in the slideshow.byte[]getChecksum()static byte[]getChecksum(byte[] data)Compute 16-byte checksum of this picture using MD5 algorithm.StringgetContentType()Map<String,Supplier<?>>getGenericProperties()byte[]getHeader()Return 24 byte header which preceeds the actual picture data.DimensiongetImageDimensionInPixels()intgetIndex()Returns the 1-based index of this picture.intgetOffset()File offset in the 'Pictures' streambyte[]getRawData()Returns the formatted, binary data of this picture excluding thepreamblebytes.protected abstract intgetSignature()Blip signature.byte[]getUID()Returns 16-byte checksum of this pictureprotected intgetUIDInstanceCount()The instance type/signatures defines if one or two UID instances will be includedvoidsetData(byte[] data)voidsetIndex(int index)voidsetOffset(int offset)Deprecated.This function was only intended for POI internal use.voidsetRawData(byte[] data)Deprecated.Set image data usingsetData(byte[]).abstract voidsetSignature(int signature)protected voidsetUIDInstanceCount(int uidInstanceCount)The instance type/signatures defines if one or two UID instances will be includedvoidwrite(OutputStream out)Write this picture intoOutputStream-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren, getGenericRecordType
-
Methods inherited from interface org.apache.poi.sl.usermodel.PictureData
getData, getImageDimension, getType
-
-
-
-
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
@Deprecated @Removal(version="5.3") public HSLFPictureData()
Deprecated.UseHSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)or one of its overloads to create newHSLFPictureData. This API led to detachedHSLFPictureDatainstances (See Bugzilla 46122) and prevented adding additional functionality.
-
HSLFPictureData
@Internal protected HSLFPictureData(EscherContainerRecord bStore, EscherBSERecord bse)
Creates a new instance.- Parameters:
bStore-BStorerecord tracking all pictures. Should be attached to the slideshow that this picture is linked to.bse- Record referencing this picture. Should be attached to the slideshow that this picture is linked to.
-
-
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 formatted, binary data of this picture excluding thepreamblebytes.Primarily intended for internal POI use. Use
PictureData.getData()to retrieve the picture represented by this object.- Returns:
- Picture data formatted for the HSLF format.
- See Also:
PictureData.getData(),formatImageForSlideshow(byte[])
-
setRawData
@Deprecated @Removal(version="5.3") public void setRawData(byte[] data)
Deprecated.Set image data usingsetData(byte[]).Sets the formatted data for this picture.Primarily intended for internal POI use. Use
setData(byte[])to change the picture represented by this object.- Parameters:
data- Picture data formatted for the HSLF format. Excludes thepreamble.- See Also:
setData(byte[]),formatImageForSlideshow(byte[])
-
getOffset
public int getOffset()
File offset in the 'Pictures' stream- Returns:
- offset in the 'Pictures' stream
-
setOffset
@Deprecated @Removal(version="5.3") public void setOffset(int offset)
Deprecated.This function was only intended for POI internal use. If you have a use case you're concerned about, please open an issue in the POI issue tracker.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()
- Specified by:
getChecksumin interfacePictureData
-
getChecksum
public static byte[] getChecksum(byte[] data)
Compute 16-byte checksum of this picture using MD5 algorithm.
-
write
public void write(OutputStream out) throws IOException
Write this picture intoOutputStream- Throws:
IOException
-
create
@Deprecated @Removal(version="5.3") public static HSLFPictureData create(PictureData.PictureType type)
Deprecated.UseHSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)or one of its overloads to create newHSLFPictureData. This API led to detachedHSLFPictureDatainstances (See Bugzilla 46122) and prevented adding additional functionality.Create an instance ofHSLFPictureDataby type.- Parameters:
type- type of picture.- Returns:
- concrete instance of
HSLFPictureData.
-
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 picture.- 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
-
formatImageForSlideshow
protected abstract byte[] formatImageForSlideshow(byte[] data)
Formats the picture data for storage in the slideshow.Images stored in
HSLFSlideShows are represented differently than when they are standalone files. The exact formatting differs for each image type.- Parameters:
data- Original image data. If these bytes were written to a disk, a common image viewer would be able to render the image.- Returns:
- Formatted image representation.
-
setData
public final void setData(byte[] data) throws IOException- Specified by:
setDatain interfacePictureData- Throws:
IOException
-
getContentType
public final String getContentType()
- Specified by:
getContentTypein interfacePictureData
-
getImageDimensionInPixels
public Dimension getImageDimensionInPixels()
- Specified by:
getImageDimensionInPixelsin interfacePictureData
-
getGenericProperties
public Map<String,Supplier<?>> getGenericProperties()
- Specified by:
getGenericPropertiesin interfaceGenericRecord
-
-