@SuppressWarnings("unchecked")
public static <T> void testSerializeDeserialize(T... objects) throws Exception {
ByteBufferOutputStream os = new ByteBufferOutputStream();
DataOutputStream dos = new DataOutputStream(os);
ByteBufferInputStream is = null;
DataInputStream dis = null;
GoraMapReduceUtils.setIOSerializations(conf, true);
try {
for(T before : objects) {
IOUtils.serialize(conf, dos , before, (Class<T>)before.getClass());
dos.flush();
}
is = new ByteBufferInputStream(os.getBufferList());
dis = new DataInputStream(is);
for(T before : objects) {
T after = IOUtils.deserialize(conf, dis, null, (Class<T>)before.getClass());