public static String toPem(Object object) throws Exception {
  StringWriter sw=new StringWriter();
  PEMWriter pw=new PEMWriter(sw);
  pw.writeObject(object);
  pw.flush();
  return sw.toString();
}

public static String toPem ( Object object ) throws Exception { StringWriter sw = new StringWriter ( ) ; PEMWriter pw = new PEMWriter ( sw ) ; pw . writeObject ( object ) ; pw . flush ( ) ; return sw . toString ( ) ; }
returns a pem string representation of a object .
