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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HSLFPictureData
Deprecated.UseHSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)
or one of its overloads to create newHSLFPictureData
.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 String
Returns content type (mime type) of this picture.byte[]
Return 24 byte header which preceeds the actual picture data.Return the original image dimensions in pixelsint
getIndex()
Returns the 1-based index of this picture.int
File offset in the 'Pictures' streambyte[]
Returns the formatted, binary data of this picture excluding thepreamble
bytes.byte[]
getUID()
Returns 16-byte checksum of this picturefinal void
setData
(byte[] data) Sets the binary picture datavoid
setIndex
(int index) void
setOffset
(int offset) Deprecated.This function was only intended for POI internal use.void
setRawData
(byte[] data) Deprecated.Set image data usingsetData(byte[])
.abstract void
setSignature
(int signature) void
write
(OutputStream out) Write this picture intoOutputStream
Methods inherited from class java.lang.Object
equals, 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
-
Constructor Details
-
HSLFPictureData
Deprecated.UseHSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)
or one of its overloads to create newHSLFPictureData
. This API led to detachedHSLFPictureData
instances (See Bugzilla 46122) and prevented adding additional functionality.
-
-
Method Details
-
setSignature
public abstract void setSignature(int signature) -
getRawData
public byte[] getRawData()Returns the formatted, binary data of this picture excluding thepreamble
bytes.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:
-
setRawData
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:
-
getOffset
public int getOffset()File offset in the 'Pictures' stream- Returns:
- offset in the 'Pictures' stream
-
setOffset
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()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 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
-
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 detachedHSLFPictureData
instances (See Bugzilla 46122) and prevented adding additional functionality.Create an instance ofHSLFPictureData
by 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
-
setData
Description copied from interface:PictureData
Sets 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:
setData
in interfacePictureData
- Parameters:
data
- picture data- Throws:
IOException
-
getContentType
Description copied from interface:PictureData
Returns content type (mime type) of this picture.- Specified by:
getContentType
in interfacePictureData
- Returns:
- content type of this picture.
-
getImageDimensionInPixels
Description copied from interface:PictureData
Return the original image dimensions in pixels- Specified by:
getImageDimensionInPixels
in interfacePictureData
- See Also:
-
getGenericProperties
- Specified by:
getGenericProperties
in interfaceGenericRecord
-
HSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)
or one of its overloads to create newHSLFPictureData
.