|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.File
demo.rmi.filesystem.server.RemoteFileImpl
public class RemoteFileImpl
This class implements the IRemoteFile
interface for
the local file system. The implementation extends the standard
File
class. Some methods already appear in the File
class with the same signature as required by the interface and
therefore you don't see their implementation here.
As you can see this class does not extend UnicastRemoteObject
,
which means we have to manually export the remote implementations
using the UnicastRemoteObject.exportObject(java.rmi.Remote)
method.
This implementation tries to be as efficient as it can be, but
you should remember that the whole design is not very efficient itself.
The interesting methods in terms of two-way communications are the methods
that filter the file system. See their docs and the docs in the interface
for more information.
Field Summary | |
---|---|
private static long |
serialVersionUID
|
Fields inherited from class java.io.File |
---|
pathSeparator, pathSeparatorChar, separator, separatorChar |
Constructor Summary | |
---|---|
RemoteFileImpl(RemoteFileImpl parent,
String child)
Create a new remote file object that is a child of this directory. |
|
RemoteFileImpl(String pathname)
Create a new remote file object with a given path. |
Method Summary | |
---|---|
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. |
RemoteFileImpl |
getRemoteAbsoluteFile()
|
RemoteFileImpl |
getRemoteParentFile()
|
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 IRemoteFile s. |
Methods inherited from class java.io.File |
---|
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toString, toURI, toURL |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface demo.rmi.filesystem.common.IRemoteFile |
---|
canRead, canWrite, exists, getAbsolutePath, getName, getParent, getPath, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list |
Field Detail |
---|
private static final long serialVersionUID
Constructor Detail |
---|
public RemoteFileImpl(RemoteFileImpl parent, String child) throws RemoteException
RemoteException
RemoteFileImpl(String pathname) throws RemoteException
RemoteFileSystemImpl.getRoots()
.
RemoteException
Method Detail |
---|
public String getCanonicalPath() throws RemoteException
getCanonicalPath
in interface IRemoteFile
getCanonicalPath
in class File
RemoteException
public IRemoteFile getChild(String name) throws RemoteException
IRemoteFile
File.File(File, String)
), since
interfaces can't declare constructors.
getChild
in interface IRemoteFile
name
- the child's name.
RemoteException
public IRemoteInputStream getInputStream() throws RemoteException
IRemoteFile
IRemoteInputStream
with a conventional InputStream
.
getInputStream
in interface IRemoteFile
RemoteException
IRemoteInputStream
public RemoteFileImpl getRemoteAbsoluteFile() throws RemoteException
getRemoteAbsoluteFile
in interface IRemoteFile
RemoteException
public RemoteFileImpl getRemoteParentFile() throws RemoteException
getRemoteParentFile
in interface IRemoteFile
RemoteException
public IRemoteFile[] listByFilter(IRemoteFilenameFilter filter) throws RemoteException
IRemoteFile
listByFilter
in interface IRemoteFile
filter
- the filename filter.
RemoteException
public IRemoteFile[] listByRegex(String regex, boolean dirsOnly) throws RemoteException
IRemoteFile
regex
argument.
listByRegex
in interface IRemoteFile
regex
- the regular expression filter for the childs filename.dirsOnly
- If true
, only subdirectories will be considered.
RemoteException
String.matches(String);
public IRemoteFile[] listRemoteDirectories() throws RemoteException
IRemoteFile
IRemoteFile.listByFilter(IRemoteFilenameFilter)
.
listRemoteDirectories
in interface IRemoteFile
RemoteException
public IRemoteFile[] listRemoteFiles() throws RemoteException
IRemoteFile
IRemoteFile
s.
listRemoteFiles
in interface IRemoteFile
RemoteException
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
© 2002-18 Genady Beryozkin, rmi-info@genady.net. Read our Privacy policy. Hosted on RimuHosting. Visit Javalobby.