KryoSerializer extends Serializer<T> implements Serializable { @Override public T copy(Kryo kryo, T original) { try { preSerialize(original); try(CopyStream output = new CopyStream(4096)) { HTMObjectOutput writer = serializer.getObjectOutput(output); writer.writeObject(original, original.getClass()); writer.close(); try(InputStream input = output.toInputStream()) { HTMObjectInput reader = serializer.getObjectInput(input); T t = (T) reader.readObject(original.getClass()); postDeSerialize(t); return t; } } } catch(Exception e) { throw new KryoException(e); } }  @Override void write(Kryo kryo, Output output, T t); @Override T read(Kryo kryo, Input input, Class<T> aClass); @Override T copy(Kryo kryo, T original); static void registerTypes(ExecutionConfig config);  }
@Test public void testCopy() throws Exception { Tuple expected = new Tuple(42); Tuple actual = kryo.copy(expected); assertNotSame(expected, actual); assertEquals(expected, actual); }