Packages
 In this topic

*Constructors

*Methods

*Fields

 

Packages   PreviousThis PackageNext
Package com.ms.security.permissions   Previous This
Package
Next

 


Class FileIORequest

public class FileIORequest implements ISecurityRequest
{
  // Fields
  public static final int DELETE;
  public static final int READ;
  public static final int WRITE;

  // Constructors
  public FileIORequest (int type, String file);
  public FileIORequest (int type);

  // Methods
  public PermissionID getPermissionID();
  public String toString ();
}

This class represents a request for access to the file system. FileIORequest instances should be used as the security request objects for parameterized security checks involving the file I/O permission. The FileIOPermission.check method expects a FileIORequest object as its parameter.

The following example shows how to use a FileIORequest object to perform a security check to determine whether a file called sample.txt can be opened for reading.


  ...
  // Create a FileIORequest object that indicates that you want to
  // read the file called "c:\\sample.txt".

  FileIORequest sreq = new FileIORequest(FileIORequest.READ,"c:\\sample.txt");

  // Check to see that all of your callers
  // have the rights to read that file.

  PolicyEngine.checkPermission(sreq);
  ...

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

Constructors

FileIORequest

public FileIORequest (int type, String file);

Creates a FileIORequest object based on the access type requested and the name of the file to which access is requested.

ParameterDescription
type The type of access that is requested. This value must be some combination of READ, WRITE, and DELETE.
file The name of the file to which I/O access is requested.

FileIORequest

public FileIORequest (int type);

Creates a FileIORequest object based on the access type requested.

ParameterDescription
type The access type that is requested. This value must be some combination of READ, WRITE, and DELETE.

Methods

getPermissionID

public PermissionID getPermissionID();

Retrieves the permission identifier for the FileIORequest object.

Return Value:

Returns PermissionID.FILEIO.

Remarks:

This method satisfies the ISecurityRequest interface and returns PermissionID.FILEIO to indicate that instances of the FileIORequest class are associated with the file I/O permission.

toString

public String toString ();

Converts the FileIORequest object to its string representation.

Return Value:

Returns the string representation of the FileIORequest object.

Fields

DELETE
The file I/O access type that represents an attempt to delete a file.
READ
The file I/O access type that represents an attempt to open a file for reading.
WRITE
The file I/O access type that represents an attempt to open a file for writing.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.