Class Variant

java.lang.Object
org.docx4j.org.apache.poi.hpsf.Variant
Direct Known Subclasses:
VariantSupport

public class Variant
extends java.lang.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.

Author:
Rainer Klute (klute@rainer-klute.de)
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.Integer LENGTH_0
    Denotes a variant type with a length of 0 bytes.
    static java.lang.Integer LENGTH_2
    Denotes a variant type with a length of 2 bytes.
    static java.lang.Integer LENGTH_4
    Denotes a variant type with a length of 4 bytes.
    static java.lang.Integer LENGTH_8
    Denotes a variant type with a length of 8 bytes.
    static java.lang.Integer LENGTH_UNKNOWN
    Denotes a variant type with a length that is unknown to HPSF yet.
    static java.lang.Integer LENGTH_VARIABLE
    Denotes a variant type with a variable length.
    static int VT_ARRAY
    [V] SAFEARRAY*.
    static int VT_BLOB
    [P] Length prefixed bytes.
    static int VT_BLOB_OBJECT
    [P] Blob contains an object.
    static int VT_BOOL
    [V][T][P][S] True=-1, False=0.
    static int VT_BSTR
    [V][T][P][S] OLE Automation string.
    static int VT_BYREF
    [V] void* for local use.
    static int VT_CARRAY
    [T] C style array.
    static int VT_CF
    [P] Clipboard format.
    static int VT_CLSID
    [P] A Class ID.
    static int VT_CY
    [V][T][P][S] currency.
    static int VT_DATE
    [V][T][P][S] date.
    static int VT_DECIMAL
    [V][T][S] 16 byte fixed point.
    static int VT_DISPATCH
    [V][T][P][S] IDispatch *.
    static int VT_EMPTY
    [V][P] Nothing, i.e.
    static int VT_ERROR
    [V][T][S] SCODE.
    static int VT_FILETIME
    [P] FILETIME.
    static int VT_HRESULT
    [T] Standard return type.
    static int VT_I1
    [T] signed char.
    static int VT_I2
    [V][T][P][S] 2 byte signed int.
    static int VT_I4
    [V][T][P][S] 4 byte signed int.
    static int VT_I8
    [T][P] signed 64-bit int.
    static int VT_ILLEGAL
    FIXME (3): Document this!
    static int VT_ILLEGALMASKED
    FIXME (3): Document this!
    static int VT_INT
    [T] signed machine int.
    static int VT_LPSTR
    [T][P] null terminated string.
    static int VT_LPWSTR
    [T][P] wide (Unicode) null terminated string.
    static int VT_NULL
    [V][P] SQL style Null.
    static int VT_PTR
    [T] pointer type.
    static int VT_R4
    [V][T][P][S] 4 byte real.
    static int VT_R8
    [V][T][P][S] 8 byte real.
    static int VT_RESERVED
    FIXME (3): Document this!
    static int VT_SAFEARRAY
    [T] (use VT_ARRAY in VARIANT).
    static int VT_STORAGE
    [P] Name of the storage follows.
    static int VT_STORED_OBJECT
    [P] Storage contains an object.
    static int VT_STREAM
    [P] Name of the stream follows.
    static int VT_STREAMED_OBJECT
    [P] Stream contains an object.
    static int VT_TYPEMASK
    FIXME (3): Document this!
    static int VT_UI1
    [V][T][P][S] unsigned char.
    static int VT_UI2
    [T][P] unsigned short.
    static int VT_UI4
    [T][P] unsigned int.
    static int VT_UI8
    [T][P] unsigned 64-bit int.
    static int VT_UINT
    [T] unsigned machine int.
    static int VT_UNKNOWN
    [V][T][S] IUnknown *.
    static int VT_USERDEFINED
    [T] user defined type.
    static int VT_VARIANT
    [V][T][P][S] VARIANT *.
    static int VT_VECTOR
    [P] simple counted array.
    static int VT_VERSIONED_STREAM
    "MUST be a VersionedStream.
    static int VT_VOID
    [T] C style void.
  • Constructor Summary

    Constructors 
    Constructor Description
    Variant()  
  • Method Summary

    Modifier and Type Method Description
    static int getVariantLength​(long variantType)
    Returns a variant type's length.
    static java.lang.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

  • Constructor Details

  • Method Details

    • getVariantName

      public static java.lang.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.