@Override
    public WrappedArray<T> read(final Kryo kryo, final Input input, final Class<WrappedArray<T>> aClass) {
        final int size = input.readVarInt(true);
        final Object[] array = new Object[size];
        for (int i = 0; i < size; i++) {
            array[i] = kryo.readClassAndObject(input);
        }
        return new WrappedArray.ofRef<>((T[]) array);
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/structure/io/gryo/WrappedArraySerializer.java