Implement readFields of Writable
504015
public void readFields(DataInput in) throws IOException {
    this.blockId = in.readLong();
    this.blockGenStamp = in.readLong();
    super.readFields(in);
  }
765644
public static void writeValueToBeanField(Object entityBean, String fieldName, Object value) {
		Method writeMethod = ClassCacheUtils.getClassFieldWriteMethod(entityBean.getClass(), fieldName);
		if (writeMethod == null) {
			throw new DialectException("Can not find Java bean read method '" + fieldName + "'");
		} else
			try {
				writeMethod.invoke(entityBean, value);
			} catch (Exception e) {
				throw new DialectException("FieldName '" + fieldName + "' can not write with value '" + value + "'", e);
			}
	}
750955
private void writeFields() throws IOException {

    for (PropertyMeta property : properties) {
      property.writeFieldDefn(writer, shortName, writingAssocBean);
      writer.eol();
    }
    writer.eol();
  }
252911
private static Field readField(ObjectInput in, Document doc) throws IOException, ClassNotFoundException
   {
      String name = in.readUTF();
      int flags = in.readInt();
      float boost = (flags & BOOST_FLAG) > 0 ? in.readFloat() : 1.0f;
      Object value = in.readObject();
      Field field;
      if (value instanceof TokenStream)
      {
         field = new Field(name, (TokenStream)value, getTermVectorParameter(flags));
      }
      else
      {
         // The value is a String
         field =
            new Field(name, (String)value, getStoreParameter(flags), getIndexParameter(flags),
               getTermVectorParameter(flags));
      }
      field.setBoost(boost);
      field.setOmitNorms((flags & OMIT_NORMS_FLAG) > 0);
      IndexOptions indexOptions;
      if ((flags & OMIT_TF_FLAG) > 0) {
         indexOptions = IndexOptions.DOCS_ONLY;
       } else {
         indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
       }
      field.setIndexOptions(indexOptions);
      return field;
   }
1246332
private Object readDataField(int bytes, int datalen)
                    throws IOException,
                    ClassNotFoundException {

        Object value = null;

        deserializeTimer.reset();
        if (bytes == 0) { // yes, need to deserialize
            if ((databuf == null) || (databuf.length < datalen)) {
                databuf = new byte[datalen];
            }

            deserialize_time += deserializeTimer.elapsed(); // careful not to add physical i/o into time
            filemgr.read(databuf, 0, datalen); // read data
            deserializeTimer.reset();

            value = SerializationUtility.deserialize(Arrays.copyOf(databuf, datalen), htoddc.cacheName);
            bytes_deserialized += datalen; // we don't count application deserialzation

        } else {
            value = new byte[datalen]; // space for data
            deserialize_time += deserializeTimer.elapsed(); // avoid counting physical i/o
            filemgr.read((byte[]) value); // read data
            deserializeTimer.reset();
        }
        deserialize_time += deserializeTimer.elapsed();

        //
        // If static deserializion buffer bloats things get expensive.  Force 
        // reallocation if a huge object is read in.
        //
        if (datalen > 100000) {
            databuf = null;
        }

        return value;
    }
262797
public void readFields(DataInput in) throws IOException {
    int appIdLength = in.readInt();
    this.appId = new byte[appIdLength];
    in.readFully(appId);
    this.maxCount = in.readInt();
  }
423798
public void addWrittenFields(FieldSet writtenFields) {
		if(this.writtenFields == null) {
			this.writtenFields = new FieldSet(writtenFields);
		} else {
			this.writtenFields.addAll(writtenFields);
		}
	}
799756
private Map<FieldDescriptor, Object> getAllFieldsMutable() {
    final TreeMap<FieldDescriptor, Object> result =
      new TreeMap<FieldDescriptor, Object>();
    final Descriptor descriptor = internalGetFieldAccessorTable().descriptor;
    for (final FieldDescriptor field : descriptor.getFields()) {
      if (field.isRepeated()) {
        final List<?> value = (List<?>) getField(field);
        if (!value.isEmpty()) {
          result.put(field, value);
        }
      } else {
        if (hasField(field)) {
          result.put(field, getField(field));
        }
      }
    }
    return result;
  }
646669
@Trivial
    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        GetField fields = in.readFields();
        failure = (Throwable) fields.get(FAILURE, null);
        params = (String[]) fields.get(PARAMS, new String[] {});
        reason = fields.get(REASON, (short) 0);
    }
683214
private void readFields() throws IOException, ClassfileFormatException {
        // Fields
        final int fieldCount = inputStreamOrByteBuffer.readUnsignedShort();
        for (int i = 0; i < fieldCount; i++) {
            // Info on modifier flags: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.5
            final int fieldModifierFlags = inputStreamOrByteBuffer.readUnsignedShort();
            final boolean isPublicField = ((fieldModifierFlags & 0x0001) == 0x0001);
            final boolean isStaticFinalField = ((fieldModifierFlags & 0x0018) == 0x0018);
            final boolean fieldIsVisible = isPublicField || scanSpec.ignoreFieldVisibility;
            final boolean getStaticFinalFieldConstValue = scanSpec.enableStaticFinalFieldConstantInitializerValues
                    && isStaticFinalField && fieldIsVisible;
            if (!fieldIsVisible || (!scanSpec.enableFieldInfo && !getStaticFinalFieldConstValue)) {
                // Skip field
                inputStreamOrByteBuffer.readUnsignedShort(); // fieldNameCpIdx
                inputStreamOrByteBuffer.readUnsignedShort(); // fieldTypeDescriptorCpIdx
                final int attributesCount = inputStreamOrByteBuffer.readUnsignedShort();
                for (int j = 0; j < attributesCount; j++) {
                    inputStreamOrByteBuffer.readUnsignedShort(); // attributeNameCpIdx
                    final int attributeLength = inputStreamOrByteBuffer.readInt(); // == 2
                    inputStreamOrByteBuffer.skip(attributeLength);
                }
            } else {
                final int fieldNameCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
                final String fieldName = getConstantPoolString(fieldNameCpIdx);
                final int fieldTypeDescriptorCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
                final char fieldTypeDescriptorFirstChar = (char) getConstantPoolStringFirstByte(
                        fieldTypeDescriptorCpIdx);
                String fieldTypeDescriptor;
                String fieldTypeSignature = null;
                fieldTypeDescriptor = getConstantPoolString(fieldTypeDescriptorCpIdx);

                Object fieldConstValue = null;
                AnnotationInfoList fieldAnnotationInfo = null;
                final int attributesCount = inputStreamOrByteBuffer.readUnsignedShort();
                for (int j = 0; j < attributesCount; j++) {
                    final int attributeNameCpIdx = inputStreamOrByteBuffer.readUnsignedShort();
                    final int attributeLength = inputStreamOrByteBuffer.readInt(); // == 2
                    // See if field name matches one of the requested names for this class, and if it does,
                    // check if it is initialized with a constant value
                    if ((getStaticFinalFieldConstValue)
                            && constantPoolStringEquals(attributeNameCpIdx, "ConstantValue")) {
                        // http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.2
                        final int cpIdx = inputStreamOrByteBuffer.readUnsignedShort();
                        if (cpIdx < 1 || cpIdx >= cpCount) {
                            throw new ClassfileFormatException("Constant pool index " + cpIdx
                                    + ", should be in range [1, " + (cpCount - 1)
                                    + "] -- cannot continue reading class. "
                                    + "Please report this at https://github.com/classgraph/classgraph/issues");
                        }
                        fieldConstValue = getFieldConstantPoolValue(entryTag[cpIdx], fieldTypeDescriptorFirstChar,
                                cpIdx);
                    } else if (fieldIsVisible && constantPoolStringEquals(attributeNameCpIdx, "Signature")) {
                        fieldTypeSignature = getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort());
                    } else if (scanSpec.enableAnnotationInfo //
                            && (constantPoolStringEquals(attributeNameCpIdx, "RuntimeVisibleAnnotations")
                                    || (!scanSpec.disableRuntimeInvisibleAnnotations && constantPoolStringEquals(
                                            attributeNameCpIdx, "RuntimeInvisibleAnnotations")))) {
                        // Read annotation names
                        final int fieldAnnotationCount = inputStreamOrByteBuffer.readUnsignedShort();
                        if (fieldAnnotationCount > 0) {
                            if (fieldAnnotationInfo == null) {
                                fieldAnnotationInfo = new AnnotationInfoList(1);
                            }
                            for (int k = 0; k < fieldAnnotationCount; k++) {
                                final AnnotationInfo fieldAnnotation = readAnnotation();
                                fieldAnnotationInfo.add(fieldAnnotation);
                            }
                        }
                    } else {
                        // No match, just skip attribute
                        inputStreamOrByteBuffer.skip(attributeLength);
                    }
                }
                if (scanSpec.enableFieldInfo && fieldIsVisible) {
                    if (fieldInfoList == null) {
                        fieldInfoList = new FieldInfoList();
                    }
                    fieldInfoList.add(new FieldInfo(className, fieldName, fieldModifierFlags, fieldTypeDescriptor,
                            fieldTypeSignature, fieldConstValue, fieldAnnotationInfo));
                }
            }
        }
    }
579716
@Override
  public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    int numEntries = getPartialListing().length;
    blockLocations = new LocatedBlocks[numEntries];
    for (int i=0; i<numEntries; i++) {
      blockLocations[i] = new LocatedBlocks();
      blockLocations[i].readFields(in);
    }
  }
1141831
@SuppressWarnings("unchecked")
	private void initInputReaders() throws Exception {
		
		MutableReader<?> inputReader;
		
		int numGates = 0;
		//  ---------------- create the input readers ---------------------
		// in case where a logical input unions multiple physical inputs, create a union reader
		final int groupSize = this.config.getGroupSize(0);
		numGates += groupSize;
		if (groupSize == 1) {
			// non-union case
			inputReader = new MutableRecordReader<DeserializationDelegate<IT>>(this);
		} else if (groupSize > 1){
			// union case
			
			MutableRecordReader<IOReadableWritable>[] readers = new MutableRecordReader[groupSize];
			for (int j = 0; j < groupSize; ++j) {
				readers[j] = new MutableRecordReader<IOReadableWritable>(this);
			}
			inputReader = new MutableUnionRecordReader<IOReadableWritable>(readers);
		} else {
			throw new Exception("Illegal input group size in task configuration: " + groupSize);
		}
		
		this.inputTypeSerializerFactory = this.config.getInputSerializer(0, this.userCodeClassLoader);
		
		if (this.inputTypeSerializerFactory.getDataType() == Record.class) {
			// record specific deserialization
			MutableReader<Record> reader = (MutableReader<Record>) inputReader;
			this.reader = (MutableObjectIterator<IT>)new RecordReaderIterator(reader);
		} else {
			// generic data type serialization
			MutableReader<DeserializationDelegate<?>> reader = (MutableReader<DeserializationDelegate<?>>) inputReader;
			@SuppressWarnings({ "rawtypes" })
			final MutableObjectIterator<?> iter = new ReaderIterator(reader, this.inputTypeSerializerFactory.getSerializer());
			this.reader = (MutableObjectIterator<IT>)iter;
		}
		
		// final sanity check
		if (numGates != this.config.getNumInputs()) {
			throw new Exception("Illegal configuration: Number of input gates and group sizes are not consistent.");
		}
	}
237105
@Trivial
    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        GetField fields = in.readFields();
        failure = (Throwable) fields.get(FAILURE, null);
        previousResult = (byte[]) fields.get(PREVIOUS_RESULT, null);
    }
317847
private void writeFields(JsonWriterImpl out, Object value)
  {
    for (JsonField field : _fields) {
      field.write(out, value);
    }
  }
169617
public void readFields(DataInput in) throws IOException {
    resetForm();

    int numDeleteTerms = in.readInt();
    for (int i = 0; i < numDeleteTerms; i++) {
      String field = Text.readString(in);
      String text = Text.readString(in);
      deleteList.add(new Term(field, text));
    }

    RAMDirectoryUtil.readRAMFiles(in, dir);
  }
591676
function setReadOnly( obj, prop, value ) {
	Object.defineProperty( obj, prop, {
		'value': value,
		'configurable': false,
		'writable': false,
		'enumerable': true
	});
}
630649
def _set(self, instance, value, **kw):
        
        logger.debug("ATFieldManager::set: value=%r" % value)

        # check field permission
        if not self.field.checkPermission("write", instance):
            raise Unauthorized("You are not allowed to write the field {}"
                               .format(self.name))

        # check if field is writable
        if not self.field.writeable(instance):
            raise Unauthorized("Field {} is read only."
                               .format(self.name))

        # id fields take only strings
        if self.name == "id":
            value = str(value)

        # get the field mutator
        mutator = self.field.getMutator(instance)

        # Inspect function and apply *args and **kwargs if possible.
        mapply(mutator, value, **kw)

        return True