Class OaIdl.SAFEARRAY
- java.lang.Object
- 
- com.sun.jna.Structure
- 
- com.sun.jna.platform.win32.OaIdl.SAFEARRAY
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable
 - Direct Known Subclasses:
- OaIdl.SAFEARRAY.ByReference
 - Enclosing interface:
- OaIdl
 
 @FieldOrder({"cDims","fFeatures","cbElements","cLocks","pvData","rgsabound"}) public static class OaIdl.SAFEARRAY extends Structure implements java.io.Closeable Implementation of SAFEARRAY. Implements Closable, which in this case delegates to destroy, to free native memory on close.VARTYPE for the SAFEARRAY can be: - VT_BOOL
- VT_BSTR
- VT_CY
- VT_DATE
- VT_DECIMAL
- VT_DISPATCH
- VT_ERROR
- VT_I1
- VT_I2
- VT_I4
- VT_INT
- VT_R4
- VT_R8
- VT_RECORD
- VT_UI1
- VT_UI2
- VT_UI4
- VT_UINT
- VT_UNKNOWN
- VT_VARIANT
 General comment: All indices in the helper methods use java int. The native type for the indices is LONG, which is defined as: A 32-bit signed integer. The range is �2147483648 through 2147483647 decimal. 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classOaIdl.SAFEARRAY.ByReference- 
Nested classes/interfaces inherited from class com.sun.jna.StructureStructure.ByValue, Structure.FieldOrder, Structure.StructField
 
- 
 - 
Field SummaryFields Modifier and Type Field Description WinDef.ULONGcbElementsWinDef.USHORTcDimsWinDef.ULONGcLocksWinDef.USHORTfFeaturesWinDef.PVOIDpvDataOaIdl.SAFEARRAYBOUND[]rgsaboundThe rgsabound.- 
Fields inherited from class com.sun.jna.StructureALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE, CALCULATE_SIZE
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PointeraccessData()Lock array and retrieve pointer to datavoidclose()Implemented to satisfy Closeable interface, delegates to destroy.static OaIdl.SAFEARRAY.ByReferencecreateSafeArray(int... size)Create a SAFEARRAY with supplied VARIANT as element type.static OaIdl.SAFEARRAY.ByReferencecreateSafeArray(WTypes.VARTYPE vartype, int... size)Create a SAFEARRAY with supplied element type.voiddestroy()Destroy the underlying SAFEARRAY and free memoryintgetDimensionCount()Return number of dimensions of the SAFEARRAYjava.lang.ObjectgetElement(int... indices)Retrieve the value at the referenced index from the SAFEARRAY.longgetElemsize()Get size of one element in bytesintgetLBound(int dimension)Retrieve lower bound for the selected dimension.intgetUBound(int dimension)Retrieve upper bound for the selected dimension.WTypes.VARTYPEgetVarType()Return VARTYPE of the SAFEARRAYvoidlock()Increments the lock count of an array, and places a pointer to the array data in pvData of the array descriptor.PointerptrOfIndex(int... indices)Retrieve pointer to data element from array.voidputElement(java.lang.Object arg, int... indices)Set value atindicesinarrayto arg.voidread()Reads the fields of the struct from native memoryvoidredim(int cElements, int lLbound)Changes the right-most (least significant) bound of the specified safe array.voidunaccessData()Unlock array and invalidate the pointer retrieved via SafeArrayAccessDatavoidunlock()Decrements the lock count of an array so it can be freed or resized- 
Methods inherited from class com.sun.jna.StructureallocateMemory, allocateMemory, autoAllocate, autoRead, autoRead, autoWrite, autoWrite, cacheTypeInfo, calculateSize, clear, createFieldsOrder, createFieldsOrder, createFieldsOrder, createFieldsOrder, dataEquals, dataEquals, ensureAllocated, equals, fieldOffset, getAutoRead, getAutoWrite, getFieldList, getFieldOrder, getFields, getNativeAlignment, getNativeSize, getNativeSize, getPointer, getStringEncoding, getStructAlignment, hashCode, newInstance, newInstance, readField, readField, setAlignType, setAutoRead, setAutoSynch, setAutoWrite, setStringEncoding, size, sortFields, toArray, toArray, toString, toString, useMemory, useMemory, write, writeField, writeField, writeField
 
- 
 
- 
- 
- 
Field Detail- 
cDimspublic WinDef.USHORT cDims 
 - 
fFeaturespublic WinDef.USHORT fFeatures 
 - 
cbElementspublic WinDef.ULONG cbElements 
 - 
cLockspublic WinDef.ULONG cLocks 
 - 
pvDatapublic WinDef.PVOID pvData 
 - 
rgsaboundpublic OaIdl.SAFEARRAYBOUND[] rgsabound The rgsabound.
 
- 
 - 
Constructor Detail- 
SAFEARRAYpublic SAFEARRAY() 
 - 
SAFEARRAYpublic SAFEARRAY(Pointer pointer) 
 
- 
 - 
Method Detail- 
readpublic void read() Description copied from class:StructureReads the fields of the struct from native memory
 - 
createSafeArraypublic static OaIdl.SAFEARRAY.ByReference createSafeArray(int... size) Create a SAFEARRAY with supplied VARIANT as element type.This helper creates a basic SAFEARRAY with a base type of VT_VARIANT. The array will have as many dimensions as parameters are passed in. The lowerbound for each dimension is set to zero, the count to the parameter value. - Parameters:
- size- array of dimension size
- Returns:
- SAFEARRAYWrapper or NULLif creation fails.
 
 - 
createSafeArraypublic static OaIdl.SAFEARRAY.ByReference createSafeArray(WTypes.VARTYPE vartype, int... size) Create a SAFEARRAY with supplied element type.The array will have as many dimensions as parameters are passed in. The lowerbound for each dimension is set to zero, the count to the parameter value. - Parameters:
- vartype- type of array contents (see Variant.VT_* constants)
- size- array of dimension size
- Returns:
- SAFEARRAYWrapper or NULLif creation fails.
 
 - 
putElementpublic void putElement(java.lang.Object arg, int... indices)Set value atindicesinarrayto arg.The supplied argument is copied into the array. If the value is no longer needed, it needs to be freed if not handled automatically. - Parameters:
- indices- the index, order follows java/C convention
- arg- the arg
 
 - 
getElementpublic java.lang.Object getElement(int... indices) Retrieve the value at the referenced index from the SAFEARRAY.The function creates a copy of the value. The values are allocated with native functions and need to be freed accordingly. - Parameters:
- indices- the index, order follows java/C convention
- Returns:
- the variant
 
 - 
ptrOfIndexpublic Pointer ptrOfIndex(int... indices) Retrieve pointer to data element from array.Caller is responsible for (un)locking the array via OleAuto.SafeArrayLock(com.sun.jna.platform.win32.OaIdl.SAFEARRAY)andOleAuto.SafeArrayUnlock(com.sun.jna.platform.win32.OaIdl.SAFEARRAY)or the helper methods:lock()andunlock().- Parameters:
- indices- the index, order follows java/C convention
- Returns:
- the pointer to the data element
 
 - 
destroypublic void destroy() Destroy the underlying SAFEARRAY and free memory
 - 
closepublic void close() Implemented to satisfy Closeable interface, delegates to destroy.- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
 
 - 
getLBoundpublic int getLBound(int dimension) Retrieve lower bound for the selected dimension.As in the all the accessor functions, that index is converted to java conventions. - Parameters:
- dimension- zerobased index
- Returns:
- lower bound for the selected dimension
 
 - 
getUBoundpublic int getUBound(int dimension) Retrieve upper bound for the selected dimension.As in the all the accessor functions, that index is converted to java conventions. - Parameters:
- dimension- zerobased index
- Returns:
- upper bound for the selected dimension
 
 - 
getDimensionCountpublic int getDimensionCount() Return number of dimensions of the SAFEARRAY- Returns:
- number of dimensions of the SAFEARRAY
 
 - 
accessDatapublic Pointer accessData() Lock array and retrieve pointer to data- Returns:
- Pointer to arraydata
 
 - 
unaccessDatapublic void unaccessData() Unlock array and invalidate the pointer retrieved via SafeArrayAccessData
 - 
lockpublic void lock() Increments the lock count of an array, and places a pointer to the array data in pvData of the array descriptor.
 - 
unlockpublic void unlock() Decrements the lock count of an array so it can be freed or resized
 - 
redimpublic void redim(int cElements, int lLbound)Changes the right-most (least significant) bound of the specified safe array.- Parameters:
- cElements-
- lLbound-
 
 - 
getVarTypepublic WTypes.VARTYPE getVarType() Return VARTYPE of the SAFEARRAY- Returns:
- VARTYPE of the SAFEARRAY
 
 - 
getElemsizepublic long getElemsize() Get size of one element in bytes- Returns:
- element size in bytes
 
 
- 
 
-