Class Variant

  • Direct Known Subclasses:
    VariantSupport

    public class Variant
    extends Object
    The Variant types as defined by Microsoft's COM. 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
    • Field Detail

      • VT_EMPTY

        public static final int VT_EMPTY
        [V][P] Nothing, i.e. not a single byte of data.
        See Also:
        Constant Field Values
      • VT_BSTR

        public static final int VT_BSTR
        [V][T][P][S] OLE Automation string.
        See Also:
        Constant Field Values
      • VT_DISPATCH

        public static final int VT_DISPATCH
        [V][T][P][S] IDispatch
        See Also:
        Constant Field Values
      • VT_BOOL

        public static final int VT_BOOL
        [V][T][P][S] True=-1, False=0.
        See Also:
        Constant Field Values
      • VT_DECIMAL

        public static final int VT_DECIMAL
        [V][T][S] 16 byte fixed point.
        See Also:
        Constant Field Values
      • VT_HRESULT

        public static final int VT_HRESULT
        [T] Standard return type.
        See Also:
        Constant Field Values
      • VT_SAFEARRAY

        public static final int VT_SAFEARRAY
        [T] (use VT_ARRAY in VARIANT).
        See Also:
        Constant Field Values
      • VT_CARRAY

        public static final int VT_CARRAY
        [T] C style array. How long is this? How is it to be interpreted?
        See Also:
        Constant Field Values
      • VT_USERDEFINED

        public static final int VT_USERDEFINED
        [T] user defined type.
        See Also:
        Constant Field Values
      • VT_LPSTR

        public static final int VT_LPSTR
        [T][P] null terminated string.
        See Also:
        Constant Field Values
      • VT_LPWSTR

        public static final int VT_LPWSTR
        [T][P] wide (Unicode) null terminated string.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • VT_STREAM

        public static final int VT_STREAM
        [P] Name of the stream follows.
        See Also:
        Constant Field Values
      • VT_STORAGE

        public static final int VT_STORAGE
        [P] Name of the storage follows.
        See Also:
        Constant Field Values
      • VT_STREAMED_OBJECT

        public static final int VT_STREAMED_OBJECT
        [P] Stream contains an object.
        See Also:
        Constant Field Values
      • VT_STORED_OBJECT

        public static final int VT_STORED_OBJECT
        [P] Storage contains an object.
        See Also:
        Constant Field Values
      • VT_BLOB_OBJECT

        public static final int VT_BLOB_OBJECT
        [P] Blob contains an object.
        See Also:
        Constant Field Values
      • VT_VERSIONED_STREAM

        public static final int VT_VERSIONED_STREAM
        "MUST be a VersionedStream. The storage representing the (non-simple) property set MUST have a stream element with the name in the StreamName field." -- [MS-OLEPS] -- v20110920; Object Linking and Embedding (OLE) Property Set Data Structures; page 24 / 63
        See Also:
        Constant Field Values
      • VT_VECTOR

        public static final int VT_VECTOR
        [P] simple counted array. How long is this? How is it to be interpreted?
        See Also:
        Constant Field Values
      • VT_ARRAY

        public static final int VT_ARRAY
        [V] SAFEARRAY*. How long is this? How is it to be interpreted?
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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 Detail

      • Variant

        public Variant()
    • Method Detail

      • 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.