code: protected byte[] serialize(Object o) {
      if (o == null) {
        throw new NullPointerException("Can't serialize null");
      }
      byte[] rv=null;
      ByteArrayOutputStream bos = null;
      ObjectOutputStream os = null;
      try {
        bos = new ByteArrayOutputStream();
        os = new ObjectOutputStream(bos);
        os.writeObject(o);
        os.close();
        bos.close();
        rv = bos.toByteArray();
      } catch (IOException e) {
        throw new IllegalArgumentException("Non-serializable object", e);
      } finally {
        CloseUtil.close(os);
        CloseUtil.close(bos);
      }
      return rv;
    }
docs: Get the bytes representing the given serialized object.