public static String marshal(TokenRestriction tokenRestriction) throws Exception {
  ByteArrayOutputStream bs=new ByteArrayOutputStream();
  ObjectOutputStream os=new ObjectOutputStream(bs);
  os.writeObject(tokenRestriction);
  os.flush();
  os.close();
  return Base64.encode(bs.toByteArray());
}

public static String marshal ( TokenRestriction tokenRestriction ) throws Exception { ByteArrayOutputStream bs = new ByteArrayOutputStream ( ) ; ObjectOutputStream os = new ObjectOutputStream ( bs ) ; os . writeObject ( tokenRestriction ) ; os . flush ( ) ; os . close ( ) ; return Base64 . encode ( bs . toByteArray ( ) ) ; }
serializes the restriction object .
