public static String convertObjectToString(Object obj) throws IOException {
  ByteArrayOutputStream baos=null;
  GZIPOutputStream gos=null;
  ObjectOutputStream oos=null;
  try {
    baos=new ByteArrayOutputStream();
    gos=new GZIPOutputStream(baos);
    oos=new ObjectOutputStream(gos);
    oos.writeObject(obj);
  }
  finally {
    try {
      if (oos != null) {
        oos.close();
      }
      if (gos != null) {
        gos.close();
      }
      if (baos != null) {
        baos.close();
      }
    }
 catch (    IOException e) {
      LOG.error(e);
    }
  }
  return new String(Base64.encodeBase64(baos.toByteArray()),CarbonCommonConstants.DEFAULT_CHARSET);
}

public static String convertObjectToString ( Object obj ) throws IOException { ByteArrayOutputStream baos = null ; GZIPOutputStream gos = null ; ObjectOutputStream oos = null ; try { baos = new ByteArrayOutputStream ( ) ; gos = new GZIPOutputStream ( baos ) ; oos = new ObjectOutputStream ( gos ) ; oos . writeObject ( obj ) ; } finally { try { if ( oos != null ) { oos . close ( ) ; } if ( gos != null ) { gos . close ( ) ; } if ( baos != null ) { baos . close ( ) ; } } catch ( IOException e ) { LOG . error ( e ) ; } } return new String ( Base64 . encodeBase64 ( baos . toByteArray ( ) ) , CarbonCommonConstants . DEFAULT_CHARSET ) ; }
convert object to base64 string
