public static <IN>byte[] serialize(IN object,TypeSerializer<IN> serializer) throws IOException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  DataOutputViewStreamWrapper wrapper=new DataOutputViewStreamWrapper(new DataOutputStream(baos));
  serializer.serialize(object,wrapper);
  return baos.toByteArray();
}

public static < IN > byte [ ] serialize ( IN object , TypeSerializer < IN > serializer ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; DataOutputViewStreamWrapper wrapper = new DataOutputViewStreamWrapper ( new DataOutputStream ( baos ) ) ; serializer . serialize ( object , wrapper ) ; return baos . toByteArray ( ) ; }
serialize an object using a typeserializer .
