Microsoft SDK for Java

UserFileIOAccess Class

The UserFileIOAccess Class of the com.ms.security.permissions package represents a request to perform a user-directed file I/O operation.

public class UserFileIOAccess implements ISecurityRequest
{
  // Fields
  public static final int READ;
  public static final int READWRITE;
  public static final int WRITE;

  // Constructors
  public UserFileIOAccess(int accessType);

  // Methods
  public int getAccessFlags();
  public PermissionID getPermissionID();
  public String toString();
  public static boolean validAccessType(int acc);
}

UserFileIOAccess instances are intended to be used as the security request objects for parameterized security checks involving the user-directed file I/O permission. The UserFileIOPermission.check method expects a UserFileIOAccess object as its parameter.

Example

The following example shows how to use a UserFileIOAccess object to check permission for user-directed file I/O operations:

  ...
  // Create a UserFileIOAccess object that indicates that you
  // want to ask the user to choose a file to open for reading.

  UserFileIOAccess sreq = new UserFileIOAccess(UserFileIOAccess.READ);

  // Check to see that all of your callers have the rights to
  // initiate user-directed file operations for reading.

  PolicyEngine.checkPermission(sreq); 
  ...

For more information about checking file I/O permissions, see the PolicyEngine class and the UserFileIOPermission class.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.