Package com.sun.jna
Klasse Union
java.lang.Object
com.sun.jna.Structure
com.sun.jna.Union
- Bekannte direkte Unterklassen:
Kstat2.Kstat2NV.UNION
,LibKstat.KstatNamed.UNION
,Ntifs.REPARSE_DATA_BUFFER.REPARSE_UNION
,NTSecApi.LSA_FOREST_TRUST_RECORD.UNION
,OaIdl.BINDPTR
,OaIdl.CURRENCY
,OaIdl.DECIMAL._DECIMAL1
,OaIdl.DECIMAL._DECIMAL2
,OaIdl.ELEMDESC._ELEMDESC
,OaIdl.TYPEDESC._TYPEDESC
,OaIdl.VARDESC._VARDESC
,Perfstat.perfstat_protocol_t.AnonymousUnionPayload
,ShTypes.STRRET.UNION
,Variant.VARIANT
,Variant.VARIANT._VARIANT.__VARIANT
,WinBase.SYSTEM_INFO.UNION
,Wincon.INPUT_RECORD.Event
,WinCrypt.CERT_STRONG_SIGN_PARA.DUMMYUNION
,Winevt.EVT_VARIANT.field1_union
,Wininet.INTERNET_CACHE_ENTRY_INFO.UNION
,WinNT.LARGE_INTEGER.UNION
,WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION.AnonymousUnionPayload
,WinRas.RASTUNNELENDPOINT.UNION
,Winspool.NOTIFY_DATA
,WinUser.INPUT.INPUT_UNION
,X11.XClientMessageEvent.Data
,X11.XEvent
Represents a native union. When writing to native memory, the field
corresponding to the type passed to
setType(java.lang.Class<?>)
will be written
to native memory. Upon reading from native memory, Structure, String,
or WString fields will not be initialized unless they are
the current field as identified by a call to setType(java.lang.Class<?>)
. The current
field is always unset by default to avoid accidentally attempting to read
a field that is not valid. In the case of a String, for instance, an
invalid pointer may result in a memory fault when attempting to initialize
the String.-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen com.sun.jna.Structure
Structure.ByReference, Structure.ByValue, Structure.FFIType, Structure.FieldOrder, Structure.StructField, Structure.StructureSet
-
Feldübersicht
Von Klasse geerbte Felder com.sun.jna.Structure
ALIGN_DEFAULT, ALIGN_GNUC, ALIGN_MSVC, ALIGN_NONE, CALCULATE_SIZE, fieldList, fieldListLock, fieldOrder, fieldOrderLock, layoutInfo, layoutInfoLock, validationLock, validationMap
-
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprotected
Union()
Create a Union whose size and alignment will be calculated automatically.protected
Create a Union of the given size, using default alignment.protected
Create a Union of the given size and alignment type.protected
Union
(Pointer p, int alignType, TypeMapper mapper) Create a Union of the given size and alignment type.protected
Union
(TypeMapper mapper) Create a Union of the given size and alignment type. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungUnions do not need a field order, so automatically provide a value to satisfy checking in the Structure superclass.protected int
getNativeAlignment
(Class<?> type, Object value, boolean isFirstElement) All fields are considered the "first" element.getTypedValue
(Class<?> type) Reads the Structure field of the given type from memory, sets it as the active type and returns it.protected Object
readField
(Structure.StructField field) Avoid reading pointer-based fields and structures unless explicitly selected.Force a read of the given field from native memory.void
Indicates by type which field will be used to write to native memory.void
Indicates which field will be used to write to native memory.setTypedValue
(Object object) Set the active type and its value.protected void
writeField
(Structure.StructField field) Only the currently selected field will be written.void
writeField
(String fieldName) Write the given field value to native memory.void
writeField
(String fieldName, Object value) Write the given field value to the field and native memory.Von Klasse geerbte Methoden com.sun.jna.Structure
allocateMemory, allocateMemory, autoAllocate, autoRead, autoRead, autoWrite, autoWrite, busy, cacheTypeInfo, calculateSize, calculateSize, clear, conditionalAutoRead, createFieldsOrder, createFieldsOrder, createFieldsOrder, createFieldsOrder, dataEquals, dataEquals, ensureAllocated, equals, fieldOffset, fields, getAutoRead, getAutoWrite, getFieldList, getFields, getFieldTypeInfo, getFieldValue, getNativeSize, getNativeSize, getPointer, getStringEncoding, getStructAlignment, getTypeInfo, getTypeInfo, getTypeMapper, hashCode, newInstance, newInstance, read, reading, setAlignType, setAutoRead, setAutoSynch, setAutoWrite, setFieldValue, setStringEncoding, size, size, size, sortFields, toArray, toArray, toString, toString, updateStructureByReference, useMemory, useMemory, useMemory, validate, write
-
Konstruktordetails
-
Union
protected Union()Create a Union whose size and alignment will be calculated automatically. -
Union
Create a Union of the given size, using default alignment. -
Union
Create a Union of the given size and alignment type. -
Union
Create a Union of the given size and alignment type. -
Union
Create a Union of the given size and alignment type.
-
-
Methodendetails
-
getFieldOrder
Unions do not need a field order, so automatically provide a value to satisfy checking in the Structure superclass.- Setzt außer Kraft:
getFieldOrder
in KlasseStructure
- Gibt zurück:
- ordered list of field names
-
setType
Indicates by type which field will be used to write to native memory. If there are multiple fields of the same type, usesetType(String)
instead with the field name.- Parameter:
type
- desired active type for the union- Löst aus:
IllegalArgumentException
- if the type does not correspond to any declared union field.
-
setType
Indicates which field will be used to write to native memory.- Parameter:
fieldName
- desired field to use for the active union type- Löst aus:
IllegalArgumentException
- if the name does not correspond to any declared union field.
-
readField
Force a read of the given field from native memory.- Setzt außer Kraft:
readField
in KlasseStructure
- Parameter:
fieldName
- field to be read- Gibt zurück:
- the new field value, after updating
- Löst aus:
IllegalArgumentException
- if no field exists with the given name
-
writeField
Write the given field value to native memory. The given field will become the active one.- Setzt außer Kraft:
writeField
in KlasseStructure
- Parameter:
fieldName
- which field to synch- Löst aus:
IllegalArgumentException
- if no field exists with the given name
-
writeField
Write the given field value to the field and native memory. The given field will become the active one.- Setzt außer Kraft:
writeField
in KlasseStructure
- Parameter:
fieldName
- field to writevalue
- value to write- Löst aus:
IllegalArgumentException
- if no field exists with the given name
-
getTypedValue
Reads the Structure field of the given type from memory, sets it as the active type and returns it. Convenience method forUnion u; Class type; u.setType(type); u.read(); value = u.field;
- Parameter:
type
- class type of the Structure field to read- Gibt zurück:
- the Structure field with the given type
-
setTypedValue
Set the active type and its value. Convenience method forUnion u; Class type; u.setType(type); u.field = value;
- Parameter:
object
- instance of a class which is part of the union- Gibt zurück:
- this Union object
-
writeField
Only the currently selected field will be written.- Setzt außer Kraft:
writeField
in KlasseStructure
- Parameter:
field
- internal field representation to synch to native memory
-
readField
Avoid reading pointer-based fields and structures unless explicitly selected. Structures may contain pointer-based fields which can crash the VM if not properly initialized. -
getNativeAlignment
All fields are considered the "first" element.- Setzt außer Kraft:
getNativeAlignment
in KlasseStructure
- Parameter:
type
- field typevalue
- field value, if availableisFirstElement
- is this field the first element in the struct?- Gibt zurück:
- the native byte alignment
-