MCPcopy Index your code
hub / github.com/java-native-access/jna / write

Method write

src/com/sun/jna/Structure.java:783–814  ·  view source on GitHub ↗

Writes the fields of the struct to native memory

()

Source from the content-addressed store, hash-verified

781 * Writes the fields of the struct to native memory
782 */
783 public void write() {
784 // Avoid writing to a null pointer
785 if (memory == PLACEHOLDER_MEMORY) {
786 return;
787 }
788
789 // convenience: allocate memory if it hasn't been already; this
790 // allows structures to do field-based initialization of arrays and not
791 // have to explicitly call allocateMemory in a ctor
792 ensureAllocated();
793
794 // Update native FFI type information, if needed
795 if (this instanceof ByValue) {
796 getTypeInfo();
797 }
798
799 // Avoid redundant writes
800 if (!busy().add(this)) {
801 return;
802 }
803 try {
804 // Write all fields, except those marked 'volatile'
805 for (StructField sf : fields().values()) {
806 if (!sf.isVolatile) {
807 writeField(sf);
808 }
809 }
810 }
811 finally {
812 busy().remove(this);
813 }
814 }
815
816 /** Write the given field to native memory. The current value in the Java
817 * field will be translated into native memory.

Callers 8

dataEqualsMethod · 0.95
autoWriteMethod · 0.95
setValueMethod · 0.95
writeArrayMethod · 0.95
useMemoryMethod · 0.45
FFITypeMethod · 0.45
initMethod · 0.45

Calls 7

ensureAllocatedMethod · 0.95
getTypeInfoMethod · 0.95
busyMethod · 0.95
fieldsMethod · 0.95
writeFieldMethod · 0.95
addMethod · 0.45
removeMethod · 0.45

Tested by 1