/** * Encode the given AEL Message object into a String. * * @param object the Message object being encoded. * @return the encoded object as a string. */ @Override public String encode( Message object ) throws EncodeException { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream( baos ); oos.writeObject( object ); oos.close(); return EncodeUtil.encodeBase64Zipped( baos.toByteArray() ); } catch ( Exception e ) { throw new RuntimeException( "Unexpected error trying to encode object.", e ); } }