org.eclipse.rse.services.files
Interface IHostFile
-
public interface IHostFile
Objects that conform to this interface are delivered by the file services to their clients.
These objects are meant to represent objects that are files or file-like objects on a
remote system. These would include files, folders, directories, archives and the like.
These objects are typically "handle" objects and can be created even though their corresponding
remote resources do not exist - in this case, the
exists()
method will return
false
.
-
See Also:
-
IFileService
Method Summary
|
boolean
|
canRead
()
Determines if the file system object is "readable" on the remote file system. |
boolean
|
canWrite
()
Determines if the file system object is "writeable" on the remote file system. |
boolean
|
exists
()
Determines if the file system object exists on the remote file system. |
String
|
getAbsolutePath
()
Gets the fully qualified path to this object in the remote file system. |
long
|
getModifiedDate
()
Gets a timestamp representing the date and time of last modification to the file. |
String
|
getName
()
Gets the simple name of the file object on the remote system. |
String
|
getParentPath
()
Gets the absolute path name of the parent object of this object on the remote file system. |
long
|
getSize
()
Gets the size of the file system object on the remote file system in bytes if isFile() is true. |
boolean
|
isArchive
()
Determines if the file system object represents an archive on the remote file system. |
boolean
|
isDirectory
()
Determines if the file system object is a directory on the remote file system. |
boolean
|
isFile
()
Determines if the file system object is a file on the remote file system. |
boolean
|
isHidden
()
Determines if the file system object is hidden on the remote file system. |
boolean
|
isRoot
()
Determines if the file system object is a "root" directory on the remote file system. |
void
|
renameTo
(
String newAbsolutePath)
Renames this abstract file handle. |
getName
String getName()
- Gets the simple name of the file object on the remote system.
-
-
Returns:
- The name of the file object on the remote system devoid of any qualifying path
information.
getParentPath
String getParentPath()
- Gets the absolute path name of the parent object of this object on the remote file system.
-
-
Returns:
- The fully qualified path of any parent object for this file. This would typically be the
string representation of the absolute path as interpreted by the remote file system. Returns
null
if
isRoot()
is true.
getAbsolutePath
String getAbsolutePath()
- Gets the fully qualified path to this object in the remote file system.
The name is constructed as it would be used on the remote file system.
This string can be interpreted and used by its file service to locate
this object on the remote file system beginning at the file system root.
-
-
Returns:
- a String representing the path name. Never returns
null
.
isHidden
boolean isHidden()
- Determines if the file system object is hidden on the remote file system.
-
-
Returns:
- true if and only if the file on the remote system has a "hidden" attribute or a naming
convention that would normal indicate that it was hidden when listing the contents of its parent
on that file system. It is up to the file services to conform to the correct notion of "hidden" for
the remote systems they support.
isDirectory
boolean isDirectory()
- Determines if the file system object is a directory on the remote file system.
-
-
Returns:
- true if and only if the object on the remote system is a directory. That is, it contains
entries that can be interpreted as other IHostFile objects. A return value of true does not
necessarily imply that isFile() returns false.
isRoot
boolean isRoot()
- Determines if the file system object is a "root" directory on the remote file system.
-
-
Returns:
- true if and only if the object on the remote system is a directory whose simple name and
absolute path name are the same.
isFile
boolean isFile()
- Determines if the file system object is a file on the remote file system.
-
-
Returns:
- true if and only if the object on the remote system can be considered to have "contents" that
have the potential to be read and written as a byte or character stream. A return value of true
does not necessarily imply that
isDirectory()
returns false.
canWrite
boolean canWrite()
- Determines if the file system object is "writeable" on the remote file system.
-
-
Returns:
- true if and only if the object on the remote system is a file that can be written. This could
mean that there is write permission granted to this user or perhaps a "writable" attribute is set for the
file. It is up to the file services to conform to the correct notion of "writable" for the remote
systems they support. For directory objects this should return true if the child objects may be added
to or removed from the directory.
canRead
boolean canRead()
- Determines if the file system object is "readable" on the remote file system.
-
-
Returns:
- true if and only if the object on the remote system is a file that can be read. This could
mean that there is read permission granted to this user or perhaps a "readable" attribute is set for the
file. It is up to the file services to conform to the correct notion of "readable" for the remote
systems they support. For directory objects this should return true if the user can determine the children
of the directory.
exists
boolean exists()
- Determines if the file system object exists on the remote file system.
-
-
Returns:
- true if and only if the remote object represented by this object exists
in the remote file system. Symbolic links on a UNIX file system exist even if
the target they point to does not exist.
isArchive
boolean isArchive()
- Determines if the file system object represents an archive on the remote file system.
-
-
Returns:
- true if and only if the remote object is a file that can be "extracted" to contain other files.
Examples would be tar and zip files. It is up to the file services to conform to the correct notion of
"archive" for the remote systems they support. If a file service creates an object with
this attribute as true then the file service must be able to extract the contents of the archive.
getSize
long getSize()
- Gets the size of the file system object on the remote file system in bytes if isFile() is true.
If the storage unit on the remote system is not bytes then the file service creating this must
convert the remote value to bytes.
-
-
Returns:
- the size in bytes of the file if
isFile()
is true, 0L otherwise.
getModifiedDate
long getModifiedDate()
- Gets a timestamp representing the date and time of last modification to the file.
-
-
Returns:
- the timestamp as obtained from the remote file system.
The timestamp represents the time the file was modified in milliseconds from January 1, 1970, 00:00:00 UTC.
Note that even so, comparison of timestamps between systems should be avoided since clock resolution and
accuracy vary widely from system to system.
It may be necessary to convert from the timestamp of a remote file system to this format.
renameTo
void renameTo(
String newAbsolutePath)
- Renames this abstract file handle.
This does not physically rename the corresponding file on the
remote system, it merely updates internal bookkeeping for a
rename operation that needs to be performed separately through
an instance of @see IFileService.
Therefore, this method cannot fail and no return value is given.
-
-
Parameters:
-
newAbsolutePath
- The new path on the remote file system that
this file will be renamed to.
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.