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

Method read

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

Reads the fields of the struct from native memory

()

Source from the content-addressed store, hash-verified

585 * Reads the fields of the struct from native memory
586 */
587 public void read() {
588 // Avoid reading from a null pointer
589 if (memory == PLACEHOLDER_MEMORY) {
590 return;
591 }
592 readCalled = true;
593
594 // convenience: allocate memory and/or calculate size if it hasn't
595 // been already; this allows structures to do field-based
596 // initialization of arrays and not have to explicitly call
597 // allocateMemory in a ctor
598 ensureAllocated();
599
600 // Avoid redundant reads
601 if (!busy().add(this)) {
602 return;
603 }
604 if (this instanceof Structure.ByReference) {
605 reading().put(getPointer(), this);
606 }
607 try {
608 for (StructField structField : fields().values()) {
609 readField(structField);
610 }
611 }
612 finally {
613 busy().remove(this);
614 if (this instanceof Structure.ByReference && reading().get(getPointer()) == this) {
615 reading().remove(getPointer());
616 }
617 }
618 }
619
620 /** Returns the calculated offset of the given field.
621 * @param name field to examine

Callers 4

convertArgumentMethod · 0.95
autoReadMethod · 0.95
getValueMethod · 0.95
readArrayMethod · 0.95

Calls 10

ensureAllocatedMethod · 0.95
busyMethod · 0.95
readingMethod · 0.95
getPointerMethod · 0.95
fieldsMethod · 0.95
readFieldMethod · 0.95
putMethod · 0.80
addMethod · 0.45
removeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected