Package org.apache.poi.hslf.usermodel
Class HSLFPictureData
java.lang.Object
org.apache.poi.hslf.usermodel.HSLFPictureData
- All Implemented Interfaces:
GenericRecord,PictureData
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
FieldsModifier and TypeFieldDescriptionprotected static final intSize of the image checksum calculated using MD5 algorithm. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHSLFPictureData(EscherContainerRecord bStore, EscherBSERecord bse) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract byte[]formatImageForSlideshow(byte[] data) Formats the picture data for storage in the slideshow.byte[]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.final StringReturns content type (mime type) of this picture.byte[]Return 24 byte header which precedes the actual picture data.Return the original image dimensions in pixelsintgetIndex()Returns the 1-based index of this picture.intFile offset in the 'Pictures' streambyte[]Returns the formatted, binary data of this picture excluding thepreamblebytes.protected abstract intBlip signature.byte[]getUID()Returns 16-byte checksum of this pictureprotected intThe instance type/signatures defines if one or two UID instances will be includedfinal voidsetData(byte[] data) Sets the binary picture datavoidsetIndex(int index) 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 intoOutputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren, getGenericRecordTypeMethods inherited from interface org.apache.poi.sl.usermodel.PictureData
getData, getImageDimension, getType
-
Field Details
-
CHECKSUM_SIZE
protected static final int CHECKSUM_SIZESize of the image checksum calculated using MD5 algorithm.- See Also:
-
-
Constructor Details
-
HSLFPictureData
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 Details
-
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:
-
getOffset
public int getOffset()File offset in the 'Pictures' stream- Returns:
- offset in the 'Pictures' stream
-
getUID
public byte[] getUID()Returns 16-byte checksum of this picture -
getChecksum
public byte[] getChecksum()Description copied from interface:PictureDataGets the checksum - the checksum can be of various length - mostly it's 8 (XSLF) or 16 (HSLF) bytes long.- Specified by:
getChecksumin interfacePictureData- Returns:
- the checksum
-
getChecksum
public static byte[] getChecksum(byte[] data) Compute 16-byte checksum of this picture using MD5 algorithm. -
write
Write this picture intoOutputStream- Throws:
IOException
-
getHeader
public byte[] getHeader()Return 24 byte header which precedes 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 precedes 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
Description copied from interface:PictureDataSets the binary picture dataThe format of the data must match the format of
PictureData.getType(). Failure to match the picture data may result in data loss.- Specified by:
setDatain interfacePictureData- Parameters:
data- picture data- Throws:
IOException
-
getContentType
Description copied from interface:PictureDataReturns content type (mime type) of this picture.- Specified by:
getContentTypein interfacePictureData- Returns:
- content type of this picture.
-
getImageDimensionInPixels
Description copied from interface:PictureDataReturn the original image dimensions in pixels- Specified by:
getImageDimensionInPixelsin interfacePictureData- See Also:
-
getGenericProperties
- Specified by:
getGenericPropertiesin interfaceGenericRecord
-