Package loci.poi.hpsf

Class Variant

java.lang.Object
loci.poi.hpsf.Variant
Direct Known Subclasses:
VariantSupport

public class Variant extends Object

The Variant types as defined by Microsoft's COM. I found this information in http://www.marin.clara.net/COM/variant_type_definitions.htm.

In the variant types descriptions the following shortcuts are used: [V] - may appear in a VARIANT, [T] - may appear in a TYPEDESC, [P] - may appear in an OLE property set, [S] - may appear in a Safe Array.

Since:
2002-02-09
Version:
$Id: Variant.java 489730 2006-12-22 19:18:16Z bayard $
Author:
Rainer Klute (klute@rainer-klute.de)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Integer
    Denotes a variant type with a length of 0 bytes.
    static final Integer
    Denotes a variant type with a length of 2 bytes.
    static final Integer
    Denotes a variant type with a length of 4 bytes.
    static final Integer
    Denotes a variant type with a length of 8 bytes.
    static final Integer
    Denotes a variant type with a length that is unknown to HPSF yet.
    static final Integer
    Denotes a variant type with a variable length.
    static final int
    [V] SAFEARRAY*.
    static final int
    [P] Length prefixed bytes.
    static final int
    [P] Blob contains an object.
    static final int
    [V][T][P][S] True=-1, False=0.
    static final int
    [V][T][P][S] OLE Automation string.
    static final int
    [V] void* for local use.
    static final int
    [T] C style array.
    static final int
    [P] Clipboard format.
    static final int
    [P] A Class ID.
    static final int
    [V][T][P][S] currency.
    static final int
    [V][T][P][S] date.
    static final int
    [V][T][S] 16 byte fixed point.
    static final int
    [V][T][P][S] IDispatch *.
    static final int
    [V][P] Nothing, i.e.
    static final int
    [V][T][S] SCODE.
    static final int
    [P] FILETIME.
    static final int
    [T] Standard return type.
    static final int
    [T] signed char.
    static final int
    [V][T][P][S] 2 byte signed int.
    static final int
    [V][T][P][S] 4 byte signed int.
    static final int
    [T][P] signed 64-bit int.
    static final int
    FIXME (3): Document this!
    static final int
    FIXME (3): Document this!
    static final int
    [T] signed machine int.
    static final int
    [T][P] null terminated string.
    static final int
    [T][P] wide (Unicode) null terminated string.
    static final int
    [V][P] SQL style Null.
    static final int
    [T] pointer type.
    static final int
    [V][T][P][S] 4 byte real.
    static final int
    [V][T][P][S] 8 byte real.
    static final int
    FIXME (3): Document this!
    static final int
    [T] (use VT_ARRAY in VARIANT).
    static final int
    [P] Name of the storage follows.
    static final int
    [P] Storage contains an object.
    static final int
    [P] Name of the stream follows.
    static final int
    [P] Stream contains an object.
    static final int
    FIXME (3): Document this!
    static final int
    [V][T][P][S] unsigned char.
    static final int
    [T][P] unsigned short.
    static final int
    [T][P] unsigned int.
    static final int
    [T][P] unsigned 64-bit int.
    static final int
    [T] unsigned machine int.
    static final int
    [V][T][S] IUnknown *.
    static final int
    [T] user defined type.
    static final int
    [V][T][P][S] VARIANT *.
    static final int
    [P] simple counted array.
    static final int
    [T] C style void.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getVariantLength(long variantType)
    Returns a variant type's length.
    static String
    getVariantName(long variantType)
    Returns the variant type name associated with a variant type number.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • VT_EMPTY

      public static final int VT_EMPTY

      [V][P] Nothing, i.e. not a single byte of data.

      See Also:
    • VT_NULL

      public static final int VT_NULL

      [V][P] SQL style Null.

      See Also:
    • VT_I2

      public static final int VT_I2

      [V][T][P][S] 2 byte signed int.

      See Also:
    • VT_I4

      public static final int VT_I4

      [V][T][P][S] 4 byte signed int.

      See Also:
    • VT_R4

      public static final int VT_R4

      [V][T][P][S] 4 byte real.

      See Also:
    • VT_R8

      public static final int VT_R8

      [V][T][P][S] 8 byte real.

      See Also:
    • VT_CY

      public static final int VT_CY

      [V][T][P][S] currency. How long is this? How is it to be interpreted?

      See Also:
    • VT_DATE

      public static final int VT_DATE

      [V][T][P][S] date. How long is this? How is it to be interpreted?

      See Also:
    • VT_BSTR

      public static final int VT_BSTR

      [V][T][P][S] OLE Automation string. How long is this? How is it to be interpreted?

      See Also:
    • VT_DISPATCH

      public static final int VT_DISPATCH

      [V][T][P][S] IDispatch *. How long is this? How is it to be interpreted?

      See Also:
    • VT_ERROR

      public static final int VT_ERROR

      [V][T][S] SCODE. How long is this? How is it to be interpreted?

      See Also:
    • VT_BOOL

      public static final int VT_BOOL

      [V][T][P][S] True=-1, False=0.

      See Also:
    • VT_VARIANT

      public static final int VT_VARIANT

      [V][T][P][S] VARIANT *. How long is this? How is it to be interpreted?

      See Also:
    • VT_UNKNOWN

      public static final int VT_UNKNOWN

      [V][T][S] IUnknown *. How long is this? How is it to be interpreted?

      See Also:
    • VT_DECIMAL

      public static final int VT_DECIMAL

      [V][T][S] 16 byte fixed point.

      See Also:
    • VT_I1

      public static final int VT_I1

      [T] signed char.

      See Also:
    • VT_UI1

      public static final int VT_UI1

      [V][T][P][S] unsigned char.

      See Also:
    • VT_UI2

      public static final int VT_UI2

      [T][P] unsigned short.

      See Also:
    • VT_UI4

      public static final int VT_UI4

      [T][P] unsigned int.

      See Also:
    • VT_I8

      public static final int VT_I8

      [T][P] signed 64-bit int.

      See Also:
    • VT_UI8

      public static final int VT_UI8

      [T][P] unsigned 64-bit int.

      See Also:
    • VT_INT

      public static final int VT_INT

      [T] signed machine int.

      See Also:
    • VT_UINT

      public static final int VT_UINT

      [T] unsigned machine int.

      See Also:
    • VT_VOID

      public static final int VT_VOID

      [T] C style void.

      See Also:
    • VT_HRESULT

      public static final int VT_HRESULT

      [T] Standard return type. How long is this? How is it to be interpreted?

      See Also:
    • VT_PTR

      public static final int VT_PTR

      [T] pointer type. How long is this? How is it to be interpreted?

      See Also:
    • VT_SAFEARRAY

      public static final int VT_SAFEARRAY

      [T] (use VT_ARRAY in VARIANT).

      See Also:
    • VT_CARRAY

      public static final int VT_CARRAY

      [T] C style array. How long is this? How is it to be interpreted?

      See Also:
    • VT_USERDEFINED

      public static final int VT_USERDEFINED

      [T] user defined type. How long is this? How is it to be interpreted?

      See Also:
    • VT_LPSTR

      public static final int VT_LPSTR

      [T][P] null terminated string.

      See Also:
    • VT_LPWSTR

      public static final int VT_LPWSTR

      [T][P] wide (Unicode) null terminated string.

      See Also:
    • VT_FILETIME

      public static final int VT_FILETIME

      [P] FILETIME. The FILETIME structure holds a date and time associated with a file. The structure identifies a 64-bit integer specifying the number of 100-nanosecond intervals which have passed since January 1, 1601. This 64-bit value is split into the two dwords stored in the structure.

      See Also:
    • VT_BLOB

      public static final int VT_BLOB

      [P] Length prefixed bytes.

      See Also:
    • VT_STREAM

      public static final int VT_STREAM

      [P] Name of the stream follows.

      See Also:
    • VT_STORAGE

      public static final int VT_STORAGE

      [P] Name of the storage follows.

      See Also:
    • VT_STREAMED_OBJECT

      public static final int VT_STREAMED_OBJECT

      [P] Stream contains an object. How long is this? How is it to be interpreted?

      See Also:
    • VT_STORED_OBJECT

      public static final int VT_STORED_OBJECT

      [P] Storage contains an object. How long is this? How is it to be interpreted?

      See Also:
    • VT_BLOB_OBJECT

      public static final int VT_BLOB_OBJECT

      [P] Blob contains an object. How long is this? How is it to be interpreted?

      See Also:
    • VT_CF

      public static final int VT_CF

      [P] Clipboard format. How long is this? How is it to be interpreted?

      See Also:
    • VT_CLSID

      public static final int VT_CLSID

      [P] A Class ID.

      It consists of a 32 bit unsigned integer indicating the size of the structure, a 32 bit signed integer indicating (Clipboard Format Tag) indicating the type of data that it contains, and then a byte array containing the data.

      The valid Clipboard Format Tags are:

      typedef struct tagCLIPDATA {
       // cbSize is the size of the buffer pointed to
       // by pClipData, plus sizeof(ulClipFmt)
       ULONG              cbSize;
       long               ulClipFmt;
       BYTE*              pClipData;
       } CLIPDATA;

      See msdn.microsoft.com/library/en-us/com/stgrstrc_0uwk.asp.

      See Also:
    • VT_VECTOR

      public static final int VT_VECTOR

      [P] simple counted array. How long is this? How is it to be interpreted?

      See Also:
    • VT_ARRAY

      public static final int VT_ARRAY

      [V] SAFEARRAY*. How long is this? How is it to be interpreted?

      See Also:
    • VT_BYREF

      public static final int VT_BYREF

      [V] void* for local use. How long is this? How is it to be interpreted?

      See Also:
    • VT_RESERVED

      public static final int VT_RESERVED

      FIXME (3): Document this!

      See Also:
    • VT_ILLEGAL

      public static final int VT_ILLEGAL

      FIXME (3): Document this!

      See Also:
    • VT_ILLEGALMASKED

      public static final int VT_ILLEGALMASKED

      FIXME (3): Document this!

      See Also:
    • VT_TYPEMASK

      public static final int VT_TYPEMASK

      FIXME (3): Document this!

      See Also:
    • LENGTH_UNKNOWN

      public static final Integer LENGTH_UNKNOWN

      Denotes a variant type with a length that is unknown to HPSF yet.

    • LENGTH_VARIABLE

      public static final Integer LENGTH_VARIABLE

      Denotes a variant type with a variable length.

    • LENGTH_0

      public static final Integer LENGTH_0

      Denotes a variant type with a length of 0 bytes.

    • LENGTH_2

      public static final Integer LENGTH_2

      Denotes a variant type with a length of 2 bytes.

    • LENGTH_4

      public static final Integer LENGTH_4

      Denotes a variant type with a length of 4 bytes.

    • LENGTH_8

      public static final Integer LENGTH_8

      Denotes a variant type with a length of 8 bytes.

  • Constructor Details

    • Variant

      public Variant()
  • Method Details

    • getVariantName

      public static String getVariantName(long variantType)

      Returns the variant type name associated with a variant type number.

      Parameters:
      variantType - The variant type number
      Returns:
      The variant type name or the string "unknown variant type"
    • getVariantLength

      public static int getVariantLength(long variantType)

      Returns a variant type's length.

      Parameters:
      variantType - The variant type number
      Returns:
      The length of the variant type's data in bytes. If the length is variable, i.e. the length of a string, -1 is returned. If HPSF does not know the length, -2 is returned. The latter usually indicates an unsupported variant type.