setType 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. 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.
| Modifier and Type | Field and Description |
|---|---|
| private Structure. |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | |
| protected | |
| protected | |
| protected | Union(Pointer p, int alignType, TypeMapper mapper)
Create a Union of the given size and alignment type. |
| Modifier and Type | Method and Description |
|---|---|
| private Structure. | |
| protected List | getFieldOrder()
Overrides com. |
| protected int | getNativeAlignment(Class<?>
field type type, Object field value, if available value, boolean is this field the first element in the struct? isFirstElement)Overrides com. |
| public Object | Returns: the Structure field with the given typeclass type of the Structure field to read type)Reads the Structure field of the given type from memory, sets it as the active type and returns it. |
| public Object | Returns: the new field value, after updatingfield to be read fieldName)Overrides com. |
| protected Object | readField(Structure.
field to be read fieldOverrides com. |
| public void | |
| public void | |
| public Object | Returns: this Union objectinstance of a class which is part of the union object)Set the active type and its value. |
| public void | writeField(String
which field to synch fieldName)Overrides com. |
| public void | writeField(String
field to write fieldName, Object value to write value)Overrides com. |
| protected void | writeField(Structure.
internal field representation to synch to native memory fieldOverrides com. |
| activeField | back to summary |
|---|---|
| private Structure. | |
| Union | back to summary |
|---|---|
| protected Union() Create a Union whose size and alignment will be calculated automatically. | |
| Union | back to summary |
|---|---|
| protected Union(Pointer p) Create a Union of the given size, using default alignment. | |
| Union | back to summary |
|---|---|
| protected Union(Pointer p, int alignType) Create a Union of the given size and alignment type. | |
| Union | back to summary |
|---|---|
| protected Union(TypeMapper mapper) Create a Union of the given size and alignment type. | |
| Union | back to summary |
|---|---|
| protected Union(Pointer p, int alignType, TypeMapper mapper) Create a Union of the given size and alignment type. | |
| findField | back to summary |
|---|---|
| private Structure. Returns the field in this union with the same type as
| |
| getFieldOrder | back to summary |
|---|---|
| protected List Overrides com. Unions do not need a field order, so automatically provide a value to satisfy checking in the Structure superclass.
| |
| getNativeAlignment | back to summary |
|---|---|
| protected int getNativeAlignment(Class<?> type, Object value, boolean isFirstElement) Overrides com. All fields are considered the "first" element.
| |
| getTypedValue | back to summary |
|---|---|
| public Object getTypedValue(Class<?> type) Reads the Structure field of the given type from memory, sets it as the active type and returns it. Convenience method for
| |
| readField | back to summary |
|---|---|
| public Object readField(String fieldName) Overrides com. Force a read of the given field from native memory.
| |
| readField | back to summary |
|---|---|
| protected Object readField(Structure. Overrides com. 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.
| |
| setType | back to summary |
|---|---|
| public void setType(Class<?> type) Indicates by type which field will be used to write to native memory.
If there are multiple fields of the same type, use
| |
| setType | back to summary |
|---|---|
| public void setType(String fieldName) Indicates which field will be used to write to native memory.
| |
| setTypedValue | back to summary |
|---|---|
| public Object setTypedValue(Object object) Set the active type and its value. Convenience method for
| |
| writeField | back to summary |
|---|---|
| public void writeField(String fieldName) Overrides com. Write the given field value to native memory. The given field will become the active one.
| |
| writeField | back to summary |
|---|---|
| public void writeField(String fieldName, Object value) Overrides com. Write the given field value to the field and native memory. The given field will become the active one.
| |
| writeField | back to summary |
|---|---|
| protected void writeField(Structure. Overrides com. Only the currently selected field will be written.
| |