Collect prefixes.

@param fieldInfos
the field infos
@param field
the field
@param fieldInfo
the field info
@throws IOException
Signals that an I/O exception has occurred.
968071
private static void collectPrefixes(FieldInfos fieldInfos, String field,
      ComponentField fieldInfo, Status status) throws IOException {
    if (fieldInfo.prefix != null) {
      FieldInfo fi = fieldInfos.fieldInfo(field);
      if (fi != null) {
        String singlePositionPrefixes = fi.getAttribute(
            MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SINGLE_POSITION);
        String multiplePositionPrefixes = fi.getAttribute(
            MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_MULTIPLE_POSITION);
        String setPositionPrefixes = fi.getAttribute(
            MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SET_POSITION);
        String intersectingPrefixes = fi.getAttribute(
            MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_INTERSECTION);
        if (singlePositionPrefixes != null) {
          String[] prefixes = singlePositionPrefixes
              .split(Pattern.quote(MtasToken.DELIMITER));
          for (int i = 0; i < prefixes.length; i++) {
            fieldInfo.prefix.addSinglePosition(prefixes[i]);
          }
        }
        if (multiplePositionPrefixes != null) {
          String[] prefixes = multiplePositionPrefixes
              .split(Pattern.quote(MtasToken.DELIMITER));
          for (int i = 0; i < prefixes.length; i++) {
            fieldInfo.prefix.addMultiplePosition(prefixes[i]);
          }
        }
        if (setPositionPrefixes != null) {
          String[] prefixes = setPositionPrefixes
              .split(Pattern.quote(MtasToken.DELIMITER));
          for (int i = 0; i < prefixes.length; i++) {
            fieldInfo.prefix.addSetPosition(prefixes[i]);
          }
        }
        if (intersectingPrefixes != null) {
          String[] prefixes = intersectingPrefixes
              .split(Pattern.quote(MtasToken.DELIMITER));
          for (int i = 0; i < prefixes.length; i++) {
            fieldInfo.prefix.addIntersecting(prefixes[i]);
          }
        }
      }
    }
  }
504015
public void readFields(DataInput in) throws IOException {
    this.blockId = in.readLong();
    this.blockGenStamp = in.readLong();
    super.readFields(in);
  }
1031134
@Override
    public void readFields(DataInput in) throws IOException {
        int ordinal = in.readInt();
        contentType = ContentType.valueOf(ordinal);
        int length = WritableUtils.readVInt(in);
        if (length > MAX_BUFFER_SIZE) {
            is = (DataInputStream)in;
            return;
        }
        content = new byte[length];
        in.readFully(content, 0, length);
    }
1110634
private void initPrefixStatsField(String field) {
    if (!singlePositionPrefix.containsKey(field)) {
      singlePositionPrefix.put(field, new HashSet<String>());
    }
    if (!multiplePositionPrefix.containsKey(field)) {
      multiplePositionPrefix.put(field, new HashSet<String>());
    }
    if (!setPositionPrefix.containsKey(field)) {
      setPositionPrefix.put(field, new HashSet<String>());
    }
  }
296863
public void getStaticField(VariableElement field) throws IOException
    {
        if (!field.getModifiers().contains(Modifier.STATIC))
        {
            throw new IllegalArgumentException(field+" is not static");
        }
        int index = subClass.resolveFieldIndex(field);
        getstatic(index);
    }
698946
public static java.util.List<String> toAllGetterNames(JavacNode field) {
		return HandlerUtil.toAllGetterNames(field.getAst(), getAccessorsForField(field), field.getName(), isBoolean(field));
	}
1080671
public void addDocument(String... fields){
        for (int i = 0; i < fields.length; i++) {
            final DataType type = schema.getType(i);
            String field = fields[i];
            final Map<String, Set<Integer>> stringSetMap = this.fields.get(i);
            if(type == DataType.DateYear){ // reformat field value for date year
                 field = field.split("-")[0];
            }
            Set<Integer> integers = stringSetMap.get(field);
            if(integers == null){
                integers = new TreeSet<>();
            }
            integers.add(docPosition);
            stringSetMap.put(field, integers);
        }
        docPosition++;
    }
16462
private void checkIfPackedField() throws IOException
    {
        // Do we have the start of a packed field?
        if (packedLimit == 0 && getTagWireType(lastTag) == WIRETYPE_LENGTH_DELIMITED)
        {
            final int length = readRawVarint32();
            if (length < 0)
                throw ProtobufException.negativeSize();

            if (offset + length > limit)
                throw ProtobufException.misreportedSize();

            this.packedLimit = this.offset + length;
        }
    }
38714
public void setKey(String field, byte[] key) throws IOException {
        int hash = Arrays.hashCode(field.getBytes());
        setKey(structure.keyHash2Index.get(hash), key);
    }
1362616
private static void collectFields(Class<?> type, List<Field> fields) {
        final Field[] declaredFields = type.getDeclaredFields();
        for (Field declaredField : declaredFields) {
            if (isPersistable(declaredField)) {
                fields.add(declaredField);
            }
        }
        if (type.getSuperclass() != null) {
            collectFields(type.getSuperclass(), fields);
        }
    }
739964
public void addFields(GenericField[] fields)
	{
		for (int i=0; i < fields.length;i++)
		{
			this.fieldMap.put(fields[i].getFieldName(), fields[i]);
		}
	}
982524
public void setAttributeFieldInfos(JmxAttributeFieldInfo[] attributeFieldInfos) {
		if (this.attributeFieldInfos == null) {
			this.attributeFieldInfos = arrayToList(attributeFieldInfos);
		} else {
			for (JmxAttributeFieldInfo attributeFieldInfo : attributeFieldInfos) {
				this.attributeFieldInfos.add(attributeFieldInfo);
			}
		}
	}
700912
void readFieldsFromFSEditLog(DataInput in) throws IOException {
    this.name = UTF8.readString(in);
    this.storageID = UTF8.readString(in);
    this.infoPort = in.readShort() & 0x0000ffff;

    this.capacity = in.readLong();
    this.dfsUsed = in.readLong();
    this.remaining = in.readLong();
    this.lastUpdate = in.readLong();
    this.xceiverCount = in.readInt();
    this.location = Text.readString(in);
    this.hostName = Text.readString(in);
    setAdminState(WritableUtils.readEnum(in, AdminStates.class));
  }
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));
                }
            }
        }
    }
490742
private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException
   {
      m_writer.writeStartObject(objectName);
      for (FieldType field : fields)
      {
         Object value = container.getCurrentValue(field);
         if (value != null)
         {
            writeField(field, value);
         }
      }
      m_writer.writeEndObject();
   }
30961
public void addFieldInfo(final FieldInfo fieldInfo) {
        ArgUtils.notNull(fieldInfo, "fieldInfo");
        
        removeFieldInfo(fieldInfo.getFieldName());
        this.fieldInfos.add(fieldInfo);
    }
1332057
public void setFieldNames(List<String> fieldNames) {
    this.fieldNames = fieldNames;
    if (fields.length != fieldNames.size()) {
      Object[] oldFields = fields;
      fields = new Object[fieldNames.size()];
      System.arraycopy(oldFields, 0, fields, 0,
          Math.min(oldFields.length, fieldNames.size()));
    }
  }