Class Thumbnail
- java.lang.Object
-
- org.apache.poi.hpsf.Thumbnail
-
-
Field Summary
Fields Modifier and Type Field Description static intCF_BITMAPClipboard Format - Bitmapstatic intCF_DIBClipboard Format - Device Independent Bitmapstatic intCF_ENHMETAFILEClipboard Format - Enhanced Windows metafile formatstatic intCF_METAFILEPICTClipboard Format - Windows metafile format.static intCFTAG_FMTIDClipboard Format Tag - Format IDstatic intCFTAG_MACINTOSHClipboard Format Tag - Macintosh clipboard formatstatic intCFTAG_NODATAClipboard Format Tag - No Datastatic intCFTAG_WINDOWSClipboard Format Tag - Windows clipboard formatstatic intOFFSET_CFOffset in bytes where the Clipboard Format starts in thebyte[]returned bySummaryInformation.getThumbnail()static intOFFSET_CFTAGOffset in bytes where the Clipboard Format Tag starts in thebyte[]returned bySummaryInformation.getThumbnail()static intOFFSET_WMFDATAOffset in bytes where the Windows Metafile (WMF) image data starts in thebyte[]returned bySummaryInformation.getThumbnail()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetClipboardFormat()Returns anintrepresenting the Clipboard FormatlonggetClipboardFormatTag()Returns anintrepresenting the Clipboard Format Tagstatic intgetMaxRecordLength()byte[]getThumbnail()Returns the thumbnail as abyte[]inVT_CFformat.byte[]getThumbnailAsWMF()Returns the Thumbnail as abyte[]of WMF data if the Thumbnail's Clipboard Format Tag isCFTAG_WINDOWSand its Clipboard Format isCF_METAFILEPICTstatic voidsetMaxRecordLength(int length)voidsetThumbnail(byte[] thumbnail)Sets the Thumbnail's underlyingbyte[]inVT_CFformat.
-
-
-
Field Detail
-
OFFSET_CFTAG
public static final int OFFSET_CFTAG
Offset in bytes where the Clipboard Format Tag starts in the
byte[]returned bySummaryInformation.getThumbnail()- See Also:
- Constant Field Values
-
OFFSET_CF
public static final int OFFSET_CF
Offset in bytes where the Clipboard Format starts in the
byte[]returned bySummaryInformation.getThumbnail()This is only valid if the Clipboard Format Tag is
CFTAG_WINDOWS- See Also:
- Constant Field Values
-
OFFSET_WMFDATA
public static final int OFFSET_WMFDATA
Offset in bytes where the Windows Metafile (WMF) image data starts in the
byte[]returned bySummaryInformation.getThumbnail()There is only WMF data at this point in the
byte[]if the Clipboard Format Tag isCFTAG_WINDOWSand the Clipboard Format isCF_METAFILEPICT.Note: The
byte[]that starts atOFFSET_WMFDATAand ends atgetThumbnail().length - 1forms a complete WMF image. It can be saved to disk with a.wmffile type and read using a WMF-capable image viewer.- See Also:
- Constant Field Values
-
CFTAG_WINDOWS
public static final int CFTAG_WINDOWS
Clipboard Format Tag - Windows clipboard format
A
DWORDindicating a built-in Windows clipboard format value- See Also:
- Constant Field Values
-
CFTAG_MACINTOSH
public static final int CFTAG_MACINTOSH
Clipboard Format Tag - Macintosh clipboard format
A
DWORDindicating a Macintosh clipboard format value- See Also:
- Constant Field Values
-
CFTAG_FMTID
public static final int CFTAG_FMTID
Clipboard Format Tag - Format ID
A GUID containing a format identifier (FMTID). This is rarely used.
- See Also:
- Constant Field Values
-
CFTAG_NODATA
public static final int CFTAG_NODATA
Clipboard Format Tag - No Data
A
DWORDindicating No data. This is rarely used.- See Also:
- Constant Field Values
-
CF_METAFILEPICT
public static final int CF_METAFILEPICT
Clipboard Format - Windows metafile format. This is the recommended way to store thumbnails in Property Streams.
Note: This is not the same format used in regular WMF images. The clipboard version of this format has an extra clipboard-specific header.
- See Also:
- Constant Field Values
-
CF_DIB
public static final int CF_DIB
Clipboard Format - Device Independent Bitmap
- See Also:
- Constant Field Values
-
CF_ENHMETAFILE
public static final int CF_ENHMETAFILE
Clipboard Format - Enhanced Windows metafile format
- See Also:
- Constant Field Values
-
CF_BITMAP
public static final int CF_BITMAP
Clipboard Format - Bitmap
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Thumbnail
public Thumbnail()
Default Constructor. If you use it then one you'll have to add the thumbnail
byte[]fromSummaryInformation.getThumbnail()to do any useful manipulations, otherwise you'll get aNullPointerException.
-
Thumbnail
public Thumbnail(byte[] thumbnailData)
Creates a
Thumbnailinstance and initializes with the specified image bytes.- Parameters:
thumbnailData- The thumbnail data
-
-
Method Detail
-
setMaxRecordLength
public static void setMaxRecordLength(int length)
- Parameters:
length- the max record length allowed for SubRecord
-
getMaxRecordLength
public static int getMaxRecordLength()
- Returns:
- the max record length allowed for SubRecord
-
getThumbnail
public byte[] getThumbnail()
Returns the thumbnail as a
byte[]inVT_CFformat.- Returns:
- The thumbnail value
- See Also:
SummaryInformation.getThumbnail()
-
setThumbnail
public void setThumbnail(byte[] thumbnail)
Sets the Thumbnail's underlying
byte[]inVT_CFformat.- Parameters:
thumbnail- The new thumbnail value- See Also:
SummaryInformation.getThumbnail()
-
getClipboardFormatTag
public long getClipboardFormatTag()
Returns an
intrepresenting the Clipboard Format TagPossible return values are:
- Returns:
- A flag indicating the Clipboard Format Tag
-
getClipboardFormat
public long getClipboardFormat() throws HPSFExceptionReturns an
intrepresenting the Clipboard FormatWill throw an exception if the Thumbnail's Clipboard Format Tag is not
CFTAG_WINDOWS.Possible return values are:
- Returns:
- a flag indicating the Clipboard Format
- Throws:
HPSFException- if the Thumbnail isn't CFTAG_WINDOWS
-
getThumbnailAsWMF
public byte[] getThumbnailAsWMF() throws HPSFExceptionReturns the Thumbnail as a
byte[]of WMF data if the Thumbnail's Clipboard Format Tag isCFTAG_WINDOWSand its Clipboard Format isCF_METAFILEPICTThis
byte[]is in the traditional WMF file, not the clipboard-specific version with special headers.See http://www.wvware.com/caolan/ora-wmf.html for more information on the WMF image format.
- Returns:
- A WMF image of the Thumbnail
- Throws:
HPSFException- if the Thumbnail isn't CFTAG_WINDOWS and CF_METAFILEPICT
-
-