Microsoft SDK for Java

checkRead

The checkRead method of the StandardSecurityManager Class contains the following signatures:

checkRead(String file)
checkRead(URL url)
checkRead(String file, Object context)
checkRead(FileDescriptor fd)

checkRead(String file)

Determines whether the specified file can be read by the classes active within the current execution context.

Syntax

public void checkRead(String file);

Parameters

file The file for which permission to be read by active classes is being checked.

Remarks

The check succeeds if all the classes found on the call stack possess FileIOPermissions and those permissions allow read access to the specified file. This method overrides the java.lang.SecurityManager.checkRead(String) method.

Exceptions

SecurityException if the security check fails.

checkRead(URL url)

Determines whether the specified URL can be read by the code in the current execution context.

Syntax

public static void checkRead(URL url);

Parameters

url The URL for which permission to read is being checked.

Remarks

If the specified URL is a file:// URL, this method performs a checkRead(String file) to determine if the file specified by the URL can be read. Otherwise, this method performs a checkConnect(url.getHost(),url.getPort()) to determine if the host/port can be connected to.

Exceptions

SecurityException if the security check fails.

checkRead(String file, Object context)

Determines whether the specified file and the specified context object can be read by the classes within the current execution context. This method overrides the java.lang.SecurityManager.checkRead method.

Syntax

public void checkRead(String file, Object context);

Note   The context object must be a URL object.

Parameters

file The system-dependent file name.
context The URL to be checked in addition to the file.

Exceptions

SecurityException if the file is not found.

checkRead(FileDescriptor fd)

Determines whether classes within the current execution context, based on the call stack of the current thread, can use the specified FileDescriptor object to read from the file it is associated with.

Syntax

public void checkRead(FileDescriptor fd);

Parameters

fd The file descriptor associated with the file from which permission to read is being checked.

Remarks

The check succeeds only if all the classes found on the call stack are fully trusted system classes. This method overrides the java.lang.SecurityManager.checkRead(FileDescriptor) method.

Exceptions

SecurityException if the security check fails.

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