Back to the RMI Plug-in for Eclipse

demo.rmi.filesystem.common
Interface IRemoteFile

All Superinterfaces:
Remote
All Known Implementing Classes:
RemoteFileImpl

public interface IRemoteFile
extends Remote

This interface lists the methods that can be invoked on a remote file. Majority of methods have signatures similar to the methods of File class to allow the implementation to extend File. Methods that can modify the remote file system are not part of the interface for safety reasons. Feel free to add them. Note: This is a remote interface. Invoking methods of this interface on a remote object will result in remote calls which can be a performance hit (for example when traversing the file system).

Author:
Genady Beryozkin, rmi-info@genady.net

Method Summary
 boolean canRead()
           
 boolean canWrite()
           
 boolean exists()
           
 String getAbsolutePath()
           
 String getCanonicalPath()
           
 IRemoteFile getChild(String name)
          Return a file that is a child of the current directory.
 IRemoteInputStream getInputStream()
          Return a remote input stream that can be used to read from the file.
 String getName()
           
 String getParent()
           
 String getPath()
           
 IRemoteFile getRemoteAbsoluteFile()
           
 IRemoteFile getRemoteParentFile()
           
 boolean isAbsolute()
           
 boolean isDirectory()
           
 boolean isFile()
           
 boolean isHidden()
           
 long lastModified()
           
 long length()
           
 String[] list()
          Return the names of the files in this directory.
 IRemoteFile[] listByFilter(IRemoteFilenameFilter filter)
          This method uses a remote filename filter which will result in callbacks to the client (the user of this interface) for every filename (if the implementing object is exported).
 IRemoteFile[] listByRegex(String regex, boolean dirsOnly)
          Return the files in this directory that their names (only the last segment) match the regular expression supplied as the regex argument.
 IRemoteFile[] listRemoteDirectories()
          This method returns the subdirectories of the current directory.
 IRemoteFile[] listRemoteFiles()
          Return the files in this directory as IRemoteFiles.
 

Method Detail

canRead

boolean canRead()
                throws RemoteException
Throws:
RemoteException

canWrite

boolean canWrite()
                 throws RemoteException
Throws:
RemoteException

exists

boolean exists()
               throws RemoteException
Throws:
RemoteException

getAbsolutePath

String getAbsolutePath()
                       throws RemoteException
Throws:
RemoteException

getCanonicalPath

String getCanonicalPath()
                        throws RemoteException
Throws:
RemoteException

getChild

IRemoteFile getChild(String name)
                     throws RemoteException
Return a file that is a child of the current directory. Replaces the constructor (see File.File(File, String)), since interfaces can't declare constructors.

Parameters:
name - the child's name.
Throws:
RemoteException

getInputStream

IRemoteInputStream getInputStream()
                                  throws RemoteException
Return a remote input stream that can be used to read from the file. The client code contains a class that can wrap IRemoteInputStream with a conventional InputStream.

Throws:
RemoteException
See Also:
IRemoteInputStream

getName

String getName()
               throws RemoteException
Throws:
RemoteException

getParent

String getParent()
                 throws RemoteException
Throws:
RemoteException

getPath

String getPath()
               throws RemoteException
Throws:
RemoteException

getRemoteAbsoluteFile

IRemoteFile getRemoteAbsoluteFile()
                                  throws RemoteException
Throws:
RemoteException

getRemoteParentFile

IRemoteFile getRemoteParentFile()
                                throws RemoteException
Throws:
RemoteException

isAbsolute

boolean isAbsolute()
                   throws RemoteException
Throws:
RemoteException

isDirectory

boolean isDirectory()
                    throws RemoteException
Throws:
RemoteException

isFile

boolean isFile()
               throws RemoteException
Throws:
RemoteException

isHidden

boolean isHidden()
                 throws RemoteException
Throws:
RemoteException

lastModified

long lastModified()
                  throws RemoteException
Throws:
RemoteException

length

long length()
            throws RemoteException
Throws:
RemoteException

list

String[] list()
              throws RemoteException
Return the names of the files in this directory. Using this method you will get both the files and the directories.

Throws:
RemoteException

listByFilter

IRemoteFile[] listByFilter(IRemoteFilenameFilter filter)
                           throws RemoteException
This method uses a remote filename filter which will result in callbacks to the client (the user of this interface) for every filename (if the implementing object is exported). If the filter is exported this method is won't be very efficient. In such case it would probably be more efficient to get the whole file list and filter it locally. If the filter is not exported, it will be serialized and sent to the server. In such case the filter's code is executed locally inside the server VM and the method is more efficient. However, this means that client code is being executed on the server, which may not be acceptable in the real world (security-wise). See the client code for sample use.

Parameters:
filter - the filename filter.
Returns:
Throws:
RemoteException

listByRegex

IRemoteFile[] listByRegex(String regex,
                          boolean dirsOnly)
                          throws RemoteException
Return the files in this directory that their names (only the last segment) match the regular expression supplied as the regex argument.

Parameters:
regex - the regular expression filter for the childs filename.
dirsOnly - If true, only subdirectories will be considered.
Throws:
RemoteException
See Also:
String.matches(String);

listRemoteDirectories

IRemoteFile[] listRemoteDirectories()
                                    throws RemoteException
This method returns the subdirectories of the current directory. Useful for traversal of the entire directory tree (see also listByFilter(IRemoteFilenameFilter).

Throws:
RemoteException

listRemoteFiles

IRemoteFile[] listRemoteFiles()
                              throws RemoteException
Return the files in this directory as IRemoteFiles.

Throws:
RemoteException

Back to the RMI Plug-in for Eclipse


© 2002-12 Genady Beryozkin, rmi-info@genady.net. Read our Privacy policy. Hosted on RimuHosting. Visit Javalobby.