Base64Utils { public static Object decode(String s) { Object o = null; try { byte[] data = Base64.decodeBase64(s.getBytes()); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data)); o = ois.readObject(); ois.close(); } catch (Exception e) { logger.error("Error while deserializing.", e); } return o; } private  Base64Utils(); static String encode(Serializable o); static Object decode(String s);  }
@Test public void deserializeString() throws IOException { Object deserialized = Base64Utils.decode("rO0ABXQADEhlbGxvIFdvcmxkIQ=="); Assert.assertEquals("Hello World!", deserialized); }