public Class read(Kryo kryo, Input input, Class<Class> type) { Registration registration = kryo.readClass(input); int isPrimitive = input.read(); Class typ = registration != null ? registration.getType() : null; if (typ == null || !typ.isPrimitive()) return typ; return (isPrimitive == 1) ? typ : getWrapperClass(typ); }
public EnumSet read(Kryo kryo, Input input, Class<EnumSet> type) { Registration registration = kryo.readClass(input); EnumSet object = EnumSet.noneOf(registration.getType()); Serializer serializer = registration.getSerializer(); int length = input.readInt(true); for (int i = 0; i < length; i++) object.add(serializer.read(kryo, input, null)); return object; }
@Override public List<?> read(final Kryo kryo, final Input input, final Class<List<?>> type) { final int length = input.readInt(true); Class<?> componentType = kryo.readClass(input).getType(); if (componentType.isPrimitive()) { componentType = getPrimitiveWrapperClass(componentType); } try { final Object items = Array.newInstance(componentType, length); for (int i = 0; i < length; i++) { Array.set(items, i, kryo.readClassAndObject(input)); } return Arrays.asList((Object[]) items); } catch (final Exception e) { throw new RuntimeException(e); } }
public Class read(ByteBuffer buffer) { return kryo.readClass(buffer).getType(); }