All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jnfs.RemoteFile

java.lang.Object
   |
   +----java.io.File
           |
           +----jnfs.RemoteFile

public class RemoteFile
extends File
A remote interface to a File object on the FileServer. Methods not overridden by RemoteFile are implemented in terms of remote calls if they rely on filesystem information or locally if they rely only on parsing (such as pathname manipulations).

Version:
$Id: RemoteFile.java,v 2.18 1997/05/20 17:59:39 mjr Exp $
Author:
Michael John Radwin
See Also:
File, FileServer

Method Index

 o canRead()
Tests if the application can read from the specified file.
 o canWrite()
Tests if the application can write to this file.
 o delete()
Deletes the file specified by this object.
 o exists()
Tests if the remote File exists.
 o finalize()
Ensures that the FileServer closes the corresponding file when there are no more references to it.
 o getAccessControl()
Gets permissions on the RemoteFile.
 o getAttributesPermission()
Returns the global permission represening "attributes" access
 o getDeletePermission()
Returns the global permission represening "delete" access
 o getExecutePermission()
Returns the global permission represening "execute" access
 o getListPermission()
Returns the global permission represening "list" access
 o getReadPermission()
Returns the global permission represening "read" access
 o getWritePermission()
Returns the global permission represening "write" access
 o isDirectory()
Tests if the file represented by the remote File object is a directory.
 o isFile()
Tests if the file represented by the remote File object is a "normal" file.
 o lastModified()
Returns the time that the file represented by the remote File object was last modified.
 o length()
Returns the length of the file represented by the remote File object.
 o list()
Returns a list of the files in the directory specified by the remote File object.
 o mkdir()
Creates a directory whose pathname is specified by the remote File object.
 o mkdirs()
Creates a directory whose pathname is specified by the remote File object, including any necessary parent directories.
 o renameTo(File)
Renames the file specified by the remote File object to have the pathname given by the File argument.
 o setAccessControl(Acl)
Changes permissions on the RemoteFile to acl.

Methods

 o getReadPermission
 public Permission getReadPermission()
Returns the global permission represening "read" access

 o getWritePermission
 public Permission getWritePermission()
Returns the global permission represening "write" access

 o getExecutePermission
 public Permission getExecutePermission()
Returns the global permission represening "execute" access

 o getDeletePermission
 public Permission getDeletePermission()
Returns the global permission represening "delete" access

 o getAttributesPermission
 public Permission getAttributesPermission()
Returns the global permission represening "attributes" access

 o getListPermission
 public Permission getListPermission()
Returns the global permission represening "list" access

 o getAccessControl
 public Acl getAccessControl()
Gets permissions on the RemoteFile. Permissions on a particular file don't necessarily map 1-to-1 to who can access the file or not because there may be security restrictions on the parent directories of the file that override this file's settings.

Returns:
the ACL for this file if the user can see it; null otherwise.
See Also:
getAccessControl
 o setAccessControl
 public boolean setAccessControl(Acl acl)
Changes permissions on the RemoteFile to acl.

Returns:
true if the permissions were set; false otherwise.
See Also:
setAccessControl
 o exists
 public boolean exists()
Tests if the remote File exists.

Returns:
true if the file specified by this object exists; false otherwise.
Throws: SecurityException
if a security manager exists, its checkRead method is called with the pathname of the remote File to see if the application is allowed read access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
exists in class File
 o canWrite
 public boolean canWrite()
Tests if the application can write to this file.

Returns:
true if the application is allowed to write to a file whose name is specified by this object; false otherwise.
Throws: SecurityException
if a security manager exists, its checkWrite method is called with the pathname of the remote File to see if the application is allowed write access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
canWrite in class File
 o canRead
 public boolean canRead()
Tests if the application can read from the specified file.

Returns:
true if the file specified by this object exists and the application can read the file; false otherwise.
Throws: SecurityException
if a security manager exists, its checkRead method is called with the pathname of the remote File to see if the application is allowed read access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
canRead in class File
 o isFile
 public boolean isFile()
Tests if the file represented by the remote File object is a "normal" file.

A file is "normal" if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file.

Returns:
true if the file specified by this object exists and is a "normal" file; false otherwise.
Throws: SecurityException
If a security manager exists, its checkRead method is called with the pathname of the remote File to see if the application is allowed read access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
isFile in class File
 o isDirectory
 public boolean isDirectory()
Tests if the file represented by the remote File object is a directory.

Returns:
true if the remote File exists and is a directory; false otherwise.
Throws: SecurityException
if a security manager exists, its checkRead method is called with the pathname of the remote File to see if the application is allowed read access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
isDirectory in class File
 o lastModified
 public long lastModified()
Returns the time that the file represented by the remote File object was last modified.

The return value is system dependent and should only be used to compare with other values returned by last modified. It should not be interpreted as an absolute time.

Returns:
the time the file specified by this object was last modified, or 0L if the specified file does not exist.
Throws: SecurityException
if a security manager exists, its checkRead method is called with the pathname of the remote File to see if the application is allowed read access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
lastModified in class File
 o length
 public long length()
Returns the length of the file represented by the remote File object.

Returns:
the length, in bytes, of the file specified by this object, or 0L if the specified file does not exist.
Throws: SecurityException
if a security manager exists, its checkRead method is called with the pathname of the remote File to see if the application is allowed read access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
length in class File
 o mkdir
 public boolean mkdir()
Creates a directory whose pathname is specified by the remote File object.

Returns:
true if the directory could be created; false otherwise.
Throws: SecurityException
if a security manager exists, its checkWrite method is called with the pathname of the remote File to see if the application is allowed write access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
mkdir in class File
 o renameTo
 public boolean renameTo(File dest)
Renames the file specified by the remote File object to have the pathname given by the File argument.

Parameters:
dest - the new filename.
Returns:
true if the renaming succeeds; false otherwise.
Throws: SecurityException
if a security manager exists, its checkWrite method is called both with the pathname of this file object and with the pathname of the destination target object to see if the application is allowed to write to both files.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
renameTo in class File
 o mkdirs
 public boolean mkdirs()
Creates a directory whose pathname is specified by the remote File object, including any necessary parent directories.

Returns:
true if the directory (or directories) could be created; false otherwise.
Throws: SecurityException
if a security manager exists, its checkWrite method is called with the pathname of each of the directories that is to be created, before any of the directories are created.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
mkdirs in class File
 o list
 public String[] list()
Returns a list of the files in the directory specified by the remote File object.

Returns:
an array of file names in the specified directory. This list does not include the current directory or the parent directory ("." and ".." on Unix systems).
Throws: SecurityException
If a security manager exists, its checkRead method is called with the pathname of the remote File to see if the application is allowed read access to the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
list in class File
 o delete
 public boolean delete()
Deletes the file specified by this object.

Returns:
true if the file is successfully deleted; false otherwise.
Throws: SecurityException
if a security manager exists, its checkDelete method is called with the pathname of the remote File to see if the application is allowed to delete the file.
Throws: RuntimeRemoteException
if a RemoteException is thrown.
Overrides:
delete in class File
 o finalize
 protected void finalize() throws IOException
Ensures that the FileServer closes the corresponding file when there are no more references to it.

Throws: IOException
if an I/O error occurs.
Overrides:
finalize in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index