}
public T read (Kryo kryo, Input input, Class<T> type) {
T object = create(kryo, input, type);
kryo.reference(object);
ObjectMap context = kryo.getGraphContext();
CachedField[] fields = (CachedField[])context.get(this);
if (fields == null) {
int length = input.readVarInt(true);
if (TRACE) trace("kryo", "Read " + length + " field names.");
String[] names = new String[length];
for (int i = 0; i < length; i++)
names[i] = input.readString();
fields = new CachedField[length];
CachedField[] allFields = getFields();
outer:
for (int i = 0, n = names.length; i < n; i++) {
String schemaName = names[i];
for (int ii = 0, nn = allFields.length; ii < nn; ii++) {
if (allFields[ii].field.getName().equals(schemaName)) {
fields[i] = allFields[ii];
continue outer;
}
}
if (TRACE) trace("kryo", "Ignore obsolete field: " + schemaName);
}
context.put(this, fields);
}
InputChunked inputChunked = new InputChunked(input, 1024);
for (int i = 0, n = fields.length; i < n; i++) {
CachedField cachedField = fields[i];