/** 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. */ @Override protected Object readField(StructField field) { if (field == activeField || (!Structure.class.isAssignableFrom(field.type) && !String.class.isAssignableFrom(field.type) && !WString.class.isAssignableFrom(field.type))) { return super.readField(field); } // Field not accessible // TODO: read by-value structures, to the extent possible; need a // "read cautiously" method to "read" to indicate we want to avoid // pointer-based fields return null; }
/** Force a read of the given field from native memory. The Java field * will be updated from the current contents of native memory. * @param name field to be read * @return the new field value, after updating * @throws IllegalArgumentException if no field exists with the given name */ public Object readField(String name) { ensureAllocated(); StructField f = fields().get(name); if (f == null) throw new IllegalArgumentException("No such field: " + name); return readField(f); }
/** Force a read of the given field from native memory. * @return the new field value, after updating * @throws IllegalArgumentException if no field exists with the given name */ @Override public Object readField(String fieldName) { ensureAllocated(); setType(fieldName); return super.readField(fieldName); }
readField(structField);
/** 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. */ Object readField(StructField field) { if (field == activeField || (!Structure.class.isAssignableFrom(field.type) && !String.class.isAssignableFrom(field.type) && !WString.class.isAssignableFrom(field.type))) { return super.readField(field); } // Field not accessible // TODO: read structure, to the extent possible; need a "recursive" // flag to "read" return null; }
/** 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. */ @Override protected Object readField(StructField field) { if (field == activeField || (!Structure.class.isAssignableFrom(field.type) && !String.class.isAssignableFrom(field.type) && !WString.class.isAssignableFrom(field.type))) { return super.readField(field); } // Field not accessible // TODO: read by-value structures, to the extent possible; need a // "read cautiously" method to "read" to indicate we want to avoid // pointer-based fields return null; }
/** Force a read of the given field from native memory. The Java field * will be updated from the current contents of native memory. * @param name field to be read * @return the new field value, after updating * @throws IllegalArgumentException if no field exists with the given name */ public Object readField(String name) { ensureAllocated(); StructField f = fields().get(name); if (f == null) throw new IllegalArgumentException("No such field: " + name); return readField(f); }
/** Force a read of the given field from native memory. * @return the new field value, after updating * @throws IllegalArgumentException if no field exists with the given name */ @Override public Object readField(String fieldName) { ensureAllocated(); setType(fieldName); return super.readField(fieldName); }
readField(structField);