org.apache.poi.hpsf
Class ClassID

java.lang.Object
  extended by org.apache.poi.hpsf.ClassID

public class ClassID
extends java.lang.Object

Represents a class ID (16 bytes). Unlike other little-endian type the ClassID is not just 16 bytes stored in the wrong order. Instead, it is a double word (4 bytes) followed by two words (2 bytes each) followed by 8 bytes.

The ClassID (or CLSID) is a UUID - see RFC 4122


Field Summary
static ClassID EQUATION30
           
static ClassID EXCEL_V3
           
static ClassID EXCEL_V3_CHART
           
static ClassID EXCEL_V3_MACRO
           
static ClassID EXCEL2003
           
static ClassID EXCEL2007
           
static ClassID EXCEL2007_MACRO
           
static ClassID EXCEL2007_XLSB
           
static ClassID EXCEL2010
           
static ClassID EXCEL2010_CHART
           
static ClassID EXCEL2010_ODS
           
static ClassID EXCEL95
           
static ClassID EXCEL95_CHART
           
static ClassID EXCEL97
           
static ClassID EXCEL97_CHART
           
static int LENGTH
          The number of bytes occupied by this object in the byte stream.
static ClassID OLE10_PACKAGE
           
static ClassID POWERPOINT2007
           
static ClassID POWERPOINT2007_MACRO
           
static ClassID POWERPOINT95
           
static ClassID POWERPOINT97
           
static ClassID PPT_SHOW
           
static ClassID TXT_ONLY
           
static ClassID WORD2007
           
static ClassID WORD2007_MACRO
           
static ClassID WORD95
           
static ClassID WORD97
           
static ClassID XLS_WORKBOOK
           
 
Constructor Summary
ClassID()
          Creates a ClassID and initializes its value with 0x00 bytes.
ClassID(byte[] src, int offset)
          Creates a ClassID and reads its value from a byte array.
ClassID(java.lang.String externalForm)
          Creates a ClassID from a human-readable representation of the Class ID in standard format "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}".
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks whether this ClassID is equal to another object.
 boolean equalsInverted(ClassID o)
          Checks whether this ClassID is equal to another ClassID with inverted endianess, because there are apparently not only version 1 GUIDs (aka "network" with big-endian encoding), but also version 2 GUIDs (aka "native" with little-endian encoding) out there.
 byte[] getBytes()
          Gets the bytes making out the class ID.
 int hashCode()
           
 int length()
           
 byte[] read(byte[] src, int offset)
          Reads the class ID's value from a byte array by turning little-endian into big-endian.
 void setBytes(byte[] bytes)
          Sets the bytes making out the class ID.
 java.lang.String toString()
          Returns a human-readable representation of the Class ID in standard format "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}".
 void write(byte[] dst, int offset)
          Writes the class ID to a byte array in the little-endian format.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

OLE10_PACKAGE

public static final ClassID OLE10_PACKAGE

PPT_SHOW

public static final ClassID PPT_SHOW

XLS_WORKBOOK

public static final ClassID XLS_WORKBOOK

TXT_ONLY

public static final ClassID TXT_ONLY

EXCEL_V3

public static final ClassID EXCEL_V3

EXCEL_V3_CHART

public static final ClassID EXCEL_V3_CHART

EXCEL_V3_MACRO

public static final ClassID EXCEL_V3_MACRO

EXCEL95

public static final ClassID EXCEL95

EXCEL95_CHART

public static final ClassID EXCEL95_CHART

EXCEL97

public static final ClassID EXCEL97

EXCEL97_CHART

public static final ClassID EXCEL97_CHART

EXCEL2003

public static final ClassID EXCEL2003

EXCEL2007

public static final ClassID EXCEL2007

EXCEL2007_MACRO

public static final ClassID EXCEL2007_MACRO

EXCEL2007_XLSB

public static final ClassID EXCEL2007_XLSB

EXCEL2010

public static final ClassID EXCEL2010

EXCEL2010_CHART

public static final ClassID EXCEL2010_CHART

EXCEL2010_ODS

public static final ClassID EXCEL2010_ODS

WORD97

public static final ClassID WORD97

WORD95

public static final ClassID WORD95

WORD2007

public static final ClassID WORD2007

WORD2007_MACRO

public static final ClassID WORD2007_MACRO

POWERPOINT97

public static final ClassID POWERPOINT97

POWERPOINT95

public static final ClassID POWERPOINT95

POWERPOINT2007

public static final ClassID POWERPOINT2007

POWERPOINT2007_MACRO

public static final ClassID POWERPOINT2007_MACRO

EQUATION30

public static final ClassID EQUATION30

LENGTH

public static final int LENGTH
The number of bytes occupied by this object in the byte stream.

See Also:
Constant Field Values
Constructor Detail

ClassID

public ClassID(byte[] src,
               int offset)
Creates a ClassID and reads its value from a byte array.

Parameters:
src - The byte array to read from.
offset - The offset of the first byte to read.

ClassID

public ClassID()
Creates a ClassID and initializes its value with 0x00 bytes.


ClassID

public ClassID(java.lang.String externalForm)
Creates a ClassID from a human-readable representation of the Class ID in standard format "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}".

Parameters:
externalForm - representation of the Class ID represented by this object.
Method Detail

length

public int length()
Returns:
The number of bytes occupied by this object in the byte stream.

getBytes

public byte[] getBytes()
Gets the bytes making out the class ID. They are returned in correct order, i.e. big-endian.

Returns:
the bytes making out the class ID.

setBytes

public void setBytes(byte[] bytes)
Sets the bytes making out the class ID.

Parameters:
bytes - The bytes making out the class ID in big-endian format. They are copied without their order being changed.

read

public byte[] read(byte[] src,
                   int offset)
Reads the class ID's value from a byte array by turning little-endian into big-endian.

Parameters:
src - The byte array to read from
offset - The offset within the src byte array
Returns:
A byte array containing the class ID.

write

public void write(byte[] dst,
                  int offset)
           throws java.lang.ArrayStoreException
Writes the class ID to a byte array in the little-endian format.

Parameters:
dst - The byte array to write to.
offset - The offset within the dst byte array.
Throws:
java.lang.ArrayStoreException - if there is not enough room for the class ID 16 bytes in the byte array after the offset position.

equals

public boolean equals(java.lang.Object o)
Checks whether this ClassID is equal to another object.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare this ClassID with
Returns:
true if the objects are equal, else false.

equalsInverted

public boolean equalsInverted(ClassID o)
Checks whether this ClassID is equal to another ClassID with inverted endianess, because there are apparently not only version 1 GUIDs (aka "network" with big-endian encoding), but also version 2 GUIDs (aka "native" with little-endian encoding) out there.

Parameters:
o - the object to compare this ClassID with
Returns:
true if the objects are equal, else false.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Returns a human-readable representation of the Class ID in standard format "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}".

Overrides:
toString in class java.lang.Object
Returns:
String representation of the Class ID represented by this object.