public static String serializeToString(Object object) throws IOException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ObjectOutputStream oos=new ObjectOutputStream(baos);
  oos.writeObject(object);
  oos.close();
  return Base64.encode(baos.toByteArray());
}

public static String serializeToString ( Object object ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( baos ) ; oos . writeObject ( object ) ; oos . close ( ) ; return Base64 . encode ( baos . toByteArray ( ) ) ; }
serialize an object to a string
