The PermissionSet Class contains the following method:
getPermissions copies the contents of the PermissionSet, and then returns it as a PermissionDataSet that can be examined and modified.