org.apache.poi.hslf.usermodel
Class PictureData

java.lang.Object
  extended by org.apache.poi.hslf.usermodel.PictureData

public class PictureData
extends java.lang.Object

A class that represents the image data contained in the Presentation.

Author:
Yegor Kozlov

Field Summary
protected  byte[] header
          Header which holds information about this picture
static int HEADER_SIZE
          The size of the header
protected static int JPEG_HEADER
           
protected  byte[] pictdata
          Binary data of the picture
protected static int PNG_HEADER
           
 
Constructor Summary
PictureData()
           
PictureData(byte[] pictstream, int offset)
          Read a picture from "Pictures" OLE stream
 
Method Summary
static byte[] getChecksum(byte[] data)
          Compute 16-byte checksum of this picture
 byte[] getData()
           
 byte[] getHeader()
          Returns the header of the Picture
 int getSize()
          Return image size in bytes
 int getType()
          Returns type of this picture.
 byte[] getUID()
          Returns the unique identifier (UID) of this picture.
 void setData(byte[] data)
          Set picture data
 void setType(int format)
          Set the type of this picture.
 void setUID(byte[] uid)
          Set the unique identifier (UID) of this picture.
 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

HEADER_SIZE

public static final int HEADER_SIZE
The size of the header

See Also:
Constant Field Values

JPEG_HEADER

protected static final int JPEG_HEADER
See Also:
Constant Field Values

PNG_HEADER

protected static final int PNG_HEADER
See Also:
Constant Field Values

pictdata

protected byte[] pictdata
Binary data of the picture


header

protected byte[] header
Header which holds information about this picture

Constructor Detail

PictureData

public PictureData()

PictureData

public PictureData(byte[] pictstream,
                   int offset)
Read a picture from "Pictures" OLE stream

Parameters:
pictstream - the bytes to read
offset - the index of the first byte to read
Method Detail

getData

public byte[] getData()
Returns:
the binary data of this picture

setData

public void setData(byte[] data)
Set picture data


getSize

public int getSize()
Return image size in bytes

Returns:
the size of the picture in bytes

getUID

public byte[] getUID()
Returns the unique identifier (UID) of this picture. The UID is a checksum of the picture data. Its length is 16 bytes and it must be unique across the presentation.

Returns:
the unique identifier of this picture

setUID

public void setUID(byte[] uid)
Set the unique identifier (UID) of this picture.

Parameters:
uid - checksum of the picture data

setType

public void setType(int format)
Set the type of this picture.


getType

public int getType()
Returns type of this picture. Must be one of the static constans defined in the Picture class.

Returns:
type of this picture.

getHeader

public byte[] getHeader()
Returns the header of the Picture

Returns:
the header of the Picture

getChecksum

public static byte[] getChecksum(byte[] data)
Compute 16-byte checksum of this picture


write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Write this picture into OutputStream

Throws:
java.io.IOException


Copyright 2006 The Apache Software Foundation or its licensors, as applicable.