public static String encode ( Serializable o ) { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; try { ObjectOutputStream oos = new ObjectOutputStream ( bos ) ; try { oos . writeObject ( o ) ; oos . flush ( ) ; } finally { oos . close ( ) ; } return Base64 . encodeBytes ( bos . toByteArray ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
encode a object to a base64 string