RSE
Release 1.0

org.eclipse.rse.services.local.files
Class LocalHostFile

java.lang.Object
  extended byorg.eclipse.rse.services.local.files.LocalHostFile
All Implemented Interfaces:
IHostFile
Direct Known Subclasses:
LocalVirtualHostFile

public class LocalHostFile
extends Object
implements IHostFile


Constructor Summary
LocalHostFile(File file)
           
LocalHostFile(File file, boolean isRoot)
           
 
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.
 File getFile()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalHostFile

public LocalHostFile(File file)

LocalHostFile

public LocalHostFile(File file,
                     boolean isRoot)
Method Detail

getName

public String getName()
Description copied from interface: IHostFile
Gets the simple name of the file object on the remote system.

Specified by:
getName in interface IHostFile
Returns:
The name of the file object on the remote system devoid of any qualifying path information.

isHidden

public boolean isHidden()
Description copied from interface: IHostFile
Determines if the file system object is hidden on the remote file system.

Specified by:
isHidden in interface IHostFile
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.

getParentPath

public String getParentPath()
Description copied from interface: IHostFile
Gets the absolute path name of the parent object of this object on the remote file system.

Specified by:
getParentPath in interface IHostFile
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 IHostFile.isRoot() is true.

isDirectory

public boolean isDirectory()
Description copied from interface: IHostFile
Determines if the file system object is a directory on the remote file system.

Specified by:
isDirectory in interface IHostFile
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

public boolean isRoot()
Description copied from interface: IHostFile
Determines if the file system object is a "root" directory on the remote file system.

Specified by:
isRoot in interface IHostFile
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

public boolean isFile()
Description copied from interface: IHostFile
Determines if the file system object is a file on the remote file system.

Specified by:
isFile in interface IHostFile
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 IHostFile.isDirectory() returns false.

getFile

public File getFile()

exists

public boolean exists()
Description copied from interface: IHostFile
Determines if the file system object exists on the remote file system.

Specified by:
exists in interface IHostFile
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.

getAbsolutePath

public String getAbsolutePath()
Description copied from interface: IHostFile
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.

Specified by:
getAbsolutePath in interface IHostFile
Returns:
a string representing the path name. 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.

getSize

public long getSize()
Description copied from interface: IHostFile
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.

Specified by:
getSize in interface IHostFile
Returns:
the size in bytes of the file if IHostFile.isFile() is true, 0L otherwise.

getModifiedDate

public long getModifiedDate()
Description copied from interface: IHostFile
Gets a timestamp representing the date and time of last modification to the file.

Specified by:
getModifiedDate in interface IHostFile
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

public void renameTo(String newAbsolutePath)
Description copied from interface: IHostFile
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.

Specified by:
renameTo in interface IHostFile
Parameters:
newAbsolutePath - The new path on the remote file system that this file will be renamed to.

isArchive

public boolean isArchive()
Description copied from interface: IHostFile
Determines if the file system object represents an archive on the remote file system.

Specified by:
isArchive in interface IHostFile
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.

canRead

public boolean canRead()
Description copied from interface: IHostFile
Determines if the file system object is "readable" on the remote file system.

Specified by:
canRead in interface IHostFile
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.

canWrite

public boolean canWrite()
Description copied from interface: IHostFile
Determines if the file system object is "writeable" on the remote file system.

Specified by:
canWrite in interface IHostFile
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.

RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.