@Override
protected Object readArray(Object old, Schema expected, ResolvingDecoder in)
throws IOException {
Schema expectedType = expected.getElementType();
long l = in.readArrayStart();
if (l <= 0) {
return newArray(old, 0, expected);
}
Object array = newArray(old, (int) l, expected);
if (array instanceof Collection) {
@SuppressWarnings("unchecked")
Collection<Object> c = (Collection<Object>) array;
return readCollection(c, expectedType, l, in);
} else {
return readJavaArray(array, expectedType, l, in);
}
}