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
public UserFileIOPermission();
Creates a new UserFileIOPermission object that represents the specified access types.
public UserFileIOPermission(int accessType);
Creates a new UserFileIOPermission instance that allows the user to have access to specific types of file I/O.
Parameter | Description |
accessType
| The access flag. This value must be READ, WRITE, or READWRITE.
|
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.
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.
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.
Parameter | Description |
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.
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.
Exceptions:
IllegalArgumentException
if the specified object to combine with is not an instance of UserFileIOPermission.
public int compareSet (Object target);
Compares the UserFileIOPermission instance with a specified permission object.
Return Value:
Returns one of the following constants:
Parameter | Description |
target
| The permission object that the UserFileIOPermission instance is compared with.
|
public IPermission copy();
Retrieves a copy of the UserFileIOPermission object.
Return Value:
Returns the copy of the UserFileIOPermission object.
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.
Parameter | Description |
tag
| The encoding type identifier.
|
data
| The raw data to construct the object from. The type of data is specified by the tag parameter.
|
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.
Parameter | Description |
tag
| The encoding type identifier.
|
out
| The output stream to send the encoded data to.
|
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.
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.
Parameter | Description |
format
| The encoding format to retrieve the tag for.
|
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.
public String[] supportedFormats();
Retrieves the encoding formats that the permission type supports.
Return Value:
Returns an array of the supported format identifiers.
public String toString ();
Retrieves a textual representation of the permission object.
Return Value:
Returns the string representation of the permission object.