public void write(Kryo kryo, Output output, EnumSet object) {
   Serializer serializer;
   if (object.isEmpty()) {
     EnumSet tmp = EnumSet.complementOf(object);
     if (tmp.isEmpty())
       throw new KryoException("An EnumSet must have a defined Enum to be serialized.");
     serializer = kryo.writeClass(output, tmp.iterator().next().getClass()).getSerializer();
   } else {
     serializer = kryo.writeClass(output, object.iterator().next().getClass()).getSerializer();
   }
   output.writeInt(object.size(), true);
   for (Object element : object) serializer.write(kryo, output, element);
 }
 @Override
 public void write(final Kryo kryo, final Output output, final List<?> obj) {
   try {
     final Object[] array = (Object[]) _arrayField.get(obj);
     output.writeInt(array.length, true);
     final Class<?> componentType = array.getClass().getComponentType();
     kryo.writeClass(output, componentType);
     for (final Object item : array) {
       kryo.writeClassAndObject(output, item);
     }
   } catch (final RuntimeException e) {
     // Don't eat and wrap RuntimeExceptions because the ObjectBuffer.write...
     // handles SerializationException specifically (resizing the buffer)...
     throw e;
   } catch (final Exception e) {
     throw new RuntimeException(e);
   }
 }
 public void write(ByteBuffer buffer, Class clazz) {
   kryo.writeClass(buffer, clazz);
 }
 public void write(Kryo kryo, Output output, Class object) {
   kryo.writeClass(output, object);
   output.writeByte((object != null && object.isPrimitive()) ? 1 : 0);
 }