Packages
 In this topic

*Constructors

*Methods

 

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

 


Class UserFileIOPermission

public class UserFileIOPermission implements IPermission, 
            IEncodablePermission
{
  // Constructors
  public UserFileIOPermission();
  public UserFileIOPermission(int accessType);

  // Methods
  public boolean canRead ();
  public boolean canWrite ();
  public void check(Object request) throws SecurityException;
  public IPermission combine (IPermission source2);
  public int compareSet (Object target);
  public IPermission copy();
  public boolean decode(String tag, InputStream data);
  public boolean encode(String tag, OutputStream out);
  public int getAccessFlags();
  public String mapFormat(String format);
  public void setAccessFlags(int type);
  public String[] supportedFormats();
  public String toString ();
}

This class represents a permission that controls the ability to perform user-directed file I/O operations using the UserFileDialog class.

Also see com.ms.security.permissions.UserFileIOAccess

Constructors

UserFileIOPermission

public UserFileIOPermission();

Creates a new UserFileIOPermission object that represents the specified access types.

UserFileIOPermission

public UserFileIOPermission(int accessType);

Creates a new UserFileIOPermission instance that allows the user to have access to specific types of file I/O.

ParameterDescription
accessType The access flag. This value must be READ, WRITE, or READWRITE.

Methods

canRead

public boolean canRead ();

Determines whether the object allows user-directed file I/O for reading files.

Return Value:

Returns true if the object has permission to read; otherwise, returns false.

canWrite

public boolean canWrite ();

Determines whether the object allows user-directed file I/O for writing files.

Return Value:

Returns true if the object has permission to write; otherwise, returns false.

check

public void check(Object request) throws SecurityException;

Determines whether the permission object allows the specified user-directed file I/O operation.

Return Value:

No return value.

ParameterDescription
request The security request parameter. It must be an instance of the UserFileIOAccess class.

Exceptions:

SecurityException if this permission does not allow the specified operation.

combine

public IPermission combine (IPermission source2);

Creates and returns a new UserFileIOPermission object that is a combination of the current permission object and the specified permission object. The new object allows access to exactly those resources allowed by either one of the permission objects that it was constructed from.

Return Value:

Returns the resulting UserFileIOPermission object.

ParameterDescription
source2 The UserFileIOPermission object to combine with the current one.

Exceptions:

IllegalArgumentException if the specified object to combine with is not an instance of UserFileIOPermission.

compareSet

public int compareSet (Object target);

Compares the UserFileIOPermission instance with a specified permission object.

Return Value:

Returns one of the following constants:

ParameterDescription
target The permission object that the UserFileIOPermission instance is compared with.

copy

public IPermission copy();

Retrieves a copy of the UserFileIOPermission object.

Return Value:

Returns the copy of the UserFileIOPermission object.

decode

public boolean decode(String tag, InputStream data);

Decodes the contents of the specified data stream into this permission object. The tag parameter specifies the type of data in the stream.

Return Value:

Returns true if the decoding operation succeeded; otherwise, returns false.

ParameterDescription
tag The encoding type identifier.
data The raw data to construct the object from. The type of data is specified by the tag parameter.

encode

public boolean encode(String tag, OutputStream out);

Encodes the contents of this permission object, and sends the encoded data to the specified stream. The tag parameter specifies the type of encoding that should be used.

Return Value:

Returns true if the encoding operation succeeded; otherwise, returns false.

ParameterDescription
tag The encoding type identifier.
out The output stream to send the encoded data to.

getAccessFlags

public int getAccessFlags();

Retrieves the access types allowed by the permission object.

Return Value:

Returns the access flag represented by the permission object, which will be READ, WRITE, or READWRITE.

mapFormat

public String mapFormat(String format);

Retrieves a permission-specific tag, given an encoding format. The tag is then used with the encode and decode methods to specify an encoding type.

Return Value:

Returns the permission-specific tag that corresponds to the specified format.

ParameterDescription
format The encoding format to retrieve the tag for.

setAccessFlags

public void setAccessFlags(int type);

Sets the types of user-directed file I/O access that the permission object should allow.

Return Value:

No return value.

ParameterDescription
type The access flag. This value must be READ, WRITE, or READWRITE.

supportedFormats

public String[] supportedFormats();

Retrieves the encoding formats that the permission type supports.

Return Value:

Returns an array of the supported format identifiers.

toString

public String toString ();

Retrieves a textual representation of the permission object.

Return Value:

Returns the string representation of the permission object.

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