private void readStruct(StructuredFieldValue target, StructDataType priType) {
        if (version < 8) {
            throw new DeserializationException("Illegal document serialization version " + version);
        }
        int dataSize = getInt(null);
        byte unusedComprCode = getByte(null);
        int numberOfFields = getInt1_4Bytes(null);

        var fieldIds = new int[numberOfFields];
        var fieldLens = new int[numberOfFields];
        for (int i = 0; i < numberOfFields; i++) {
            fieldIds[i] = getInt1_4Bytes(null);
            fieldLens[i] = (int) getInt2_4_8Bytes(null);
        }

        int afterPos = position() + dataSize;
        for (int i = 0; i < numberOfFields; i++) {
            int posBefore = position();
            Field structField = priType.getField(fieldIds[i]);
            // ignoring unknown field
            if (structField != null) {
                FieldValue value = structField.getDataType().createFieldValue();
                value.deserialize(structField, this);
                target.setFieldValue(structField, value);
            }
            // jump to beginning of next field:
            position(posBefore + fieldLens[i]);
        }
        // set position to after data
        position(afterPos);
    }
Class used for de-serializing documents on the Vespa 6.x document format.

@author baldersheim
document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer6.java