java.io
Class FilePermissionCollection

java.lang.Object
  extended byjava.security.PermissionCollection
      extended byjava.io.FilePermissionCollection
All Implemented Interfaces:
Serializable

final class FilePermissionCollection
extends java.security.PermissionCollection
implements Serializable

A FilePermissionCollection stores a set of FilePermission permissions. FilePermission objects must be stored in a manner that allows them to be inserted in any order, but enable the implies function to evaluate the implies method. For example, if you have two FilePermissions:

  1. "/tmp/-", "read"
  2. "/tmp/scratch/foo", "write"
And you are calling the implies function with the FilePermission: "/tmp/scratch/foo", "read,write", then the implies function must take into account both the /tmp/- and /tmp/scratch/foo permissions, so the effective permission is "read,write".

Author:
Marianne Mueller, Roland Schemers
See Also:
Permission, Permissions, PermissionCollection, Serialized Form

Field Summary
private  List perms
           
private static ObjectStreamField[] serialPersistentFields
           
private static long serialVersionUID
           
 
Fields inherited from class java.security.PermissionCollection
 
Constructor Summary
FilePermissionCollection()
          Create an empty FilePermissions object.
 
Method Summary
 void add(java.security.Permission permission)
          Adds a permission to the FilePermissions.
 Enumeration elements()
          Returns an enumeration of all the FilePermission objects in the container.
 boolean implies(java.security.Permission permission)
          Check and see if this set of permissions implies the permissions expressed in "permission".
private  void readObject(ObjectInputStream in)
           
private  void writeObject(ObjectOutputStream out)
           
 
Methods inherited from class java.security.PermissionCollection
isReadOnly, setReadOnly, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

perms

private transient List perms

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

serialPersistentFields

private static final ObjectStreamField[] serialPersistentFields
Constructor Detail

FilePermissionCollection

public FilePermissionCollection()
Create an empty FilePermissions object.

Method Detail

add

public void add(java.security.Permission permission)
Adds a permission to the FilePermissions. The key for the hash is permission.path.

Parameters:
permission - the Permission object to add.
Throws:
IllegalArgumentException - - if the permission is not a FilePermission
SecurityException - - if this FilePermissionCollection object has been marked readonly

implies

public boolean implies(java.security.Permission permission)
Check and see if this set of permissions implies the permissions expressed in "permission".

Returns:
true if "permission" is a proper subset of a permission in the set, false if not.

elements

public Enumeration elements()
Returns an enumeration of all the FilePermission objects in the container.

Returns:
an enumeration of all the FilePermission objects.

writeObject

private void writeObject(ObjectOutputStream out)
                  throws IOException
Throws:
IOException

readObject

private void readObject(ObjectInputStream in)
                 throws IOException,
                        ClassNotFoundException
Throws:
IOException
ClassNotFoundException