com.myjavaworld.ftp
Class DefaultRemoteFile

java.lang.Object
  extended by com.myjavaworld.ftp.DefaultRemoteFile
All Implemented Interfaces:
RemoteFile, Serializable

public class DefaultRemoteFile
extends Object
implements RemoteFile, Serializable

The default implementation of RemoteFile interface.

Version:
2.0
Author:
Sai Pullabhotla, psai [at] jMethods [dot] com
See Also:
Serialized Form

Constructor Summary
DefaultRemoteFile(String path)
          Constructs a DefaultRemoteFile object.
DefaultRemoteFile(String path, boolean dir)
          Constructs a DefaultRemoteFile object.
DefaultRemoteFile(String parent, String name)
          Constructs a DefaultRemoteFile object.
DefaultRemoteFile(String parent, String name, boolean dir)
          Constructs a DefaultRemoteFile object.
DefaultRemoteFile(String parent, String name, boolean dir, long size, long lastModified, String attributes)
          Constructs a DefaultRemoteFile object.
DefaultRemoteFile(String parent, String name, boolean dir, long size, long lastModified, String attributes, int linkCount, String owner, String group)
          Creates an instance of DefaultRemoteFile.
 
Method Summary
 boolean equals(Object obj)
           
 String getAttributes()
          Returns the attributes of this file in standard unix format.
 String getExtension()
          Returns the extension of this file.
 String getGroup()
          Returns the group name to which the owner of this file belongs to.
 long getLastModified()
          Returns the last modified date of this file in milli seconds.
 int getLinkCount()
          Returns the number of links that point to this file.
 String getName()
          Returns the name of this remote file.
 String getNormalizedName()
          Returns the normalized name of this remote file.
 String getNormalizedPath()
          Returns the normalized path.
 Hashtable getOtherProperties()
          Returns additional properties of this file if any.
 String getOwner()
          Returns the owner of this file.
 String getPath()
          Returns the full path of this remote file.
 long getSize()
          Returns the size of this file in bytes.
 String getType()
          Returns the type of this file.
 boolean isDirectory()
          Tells whether this file is a directory or not.
 boolean isFile()
          Tells whether this file is a data file or not.
 boolean isLink()
          Checkes to see if this file is symbolic link.
 void setAttributes(String attributes)
          Sets the attributes on this file to the given attributes.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultRemoteFile

public DefaultRemoteFile(String path)
Constructs a DefaultRemoteFile object. The result object will be marked as directory.

Parameters:
path - Absolute path.

DefaultRemoteFile

public DefaultRemoteFile(String path,
                         boolean dir)
Constructs a DefaultRemoteFile object.

Parameters:
path - Absolute path
dir - Whether or not this object is a directory.

DefaultRemoteFile

public DefaultRemoteFile(String parent,
                         String name)
Constructs a DefaultRemoteFile object.

Parameters:
parent - parent file.
name - File name

DefaultRemoteFile

public DefaultRemoteFile(String parent,
                         String name,
                         boolean dir)
Constructs a DefaultRemoteFile object.

Parameters:
parent - Parent file
name - File name
dir - Whther or not this is a directory

DefaultRemoteFile

public DefaultRemoteFile(String parent,
                         String name,
                         boolean dir,
                         long size,
                         long lastModified,
                         String attributes)
Constructs a DefaultRemoteFile object.

Parameters:
parent - Parent file
name - File name
dir - Whether or not this is a directory
size - Size of this file in bytes
lastModified - Date and time this file is last modified
attributes - Attributes of this file

DefaultRemoteFile

public DefaultRemoteFile(String parent,
                         String name,
                         boolean dir,
                         long size,
                         long lastModified,
                         String attributes,
                         int linkCount,
                         String owner,
                         String group)
Creates an instance of DefaultRemoteFile.

Parameters:
parent - parent file.
name - name of this file.
dir - whether this file is a directory or not.
size - Size of this file.
lastModified - Last modified date
attributes - Attributes or permissions.
linkCount - symbolic link count
owner - Owner of this file.
group - Group to which the owner belongs to.
Method Detail

getPath

public String getPath()
Description copied from interface: RemoteFile
Returns the full path of this remote file.

Specified by:
getPath in interface RemoteFile
Returns:
Path of this remote file.

getNormalizedPath

public String getNormalizedPath()
Description copied from interface: RemoteFile
Returns the normalized path.

Specified by:
getNormalizedPath in interface RemoteFile
Returns:
normalized path.

getName

public String getName()
Description copied from interface: RemoteFile
Returns the name of this remote file.

Specified by:
getName in interface RemoteFile
Returns:
Name of this file.

getNormalizedName

public String getNormalizedName()
Description copied from interface: RemoteFile
Returns the normalized name of this remote file.

Specified by:
getNormalizedName in interface RemoteFile
Returns:
normalized name.

getExtension

public String getExtension()
Description copied from interface: RemoteFile
Returns the extension of this file. Extensions are used to determine the type of file when a file is to be transferred from/to the remote system.

Specified by:
getExtension in interface RemoteFile
Returns:
extension of this file.

getType

public String getType()
Description copied from interface: RemoteFile
Returns the type of this file.

Specified by:
getType in interface RemoteFile
Returns:
Type of this file.

getSize

public long getSize()
Description copied from interface: RemoteFile
Returns the size of this file in bytes.

Specified by:
getSize in interface RemoteFile
Returns:
size of this file in bytes.

getLastModified

public long getLastModified()
Description copied from interface: RemoteFile
Returns the last modified date of this file in milli seconds.

Specified by:
getLastModified in interface RemoteFile
Returns:
Last modified date of this file. If the last modified date is unknown a value of -1L may be returned.

isDirectory

public boolean isDirectory()
Description copied from interface: RemoteFile
Tells whether this file is a directory or not.

Specified by:
isDirectory in interface RemoteFile
Returns:
true, if this file is a directory. false otherwise.

isFile

public boolean isFile()
Description copied from interface: RemoteFile
Tells whether this file is a data file or not.

Specified by:
isFile in interface RemoteFile
Returns:
true, if this file is a data file. false otherwise.

isLink

public boolean isLink()
Description copied from interface: RemoteFile
Checkes to see if this file is symbolic link.

Specified by:
isLink in interface RemoteFile
Returns:
true, if this file is a symbolic link. false, otherwsie.

getAttributes

public String getAttributes()
Description copied from interface: RemoteFile
Returns the attributes of this file in standard unix format.

Specified by:
getAttributes in interface RemoteFile
Returns:
attributes of this file. May return blank if the attributes are unknown.

getLinkCount

public int getLinkCount()
Description copied from interface: RemoteFile
Returns the number of links that point to this file.

Specified by:
getLinkCount in interface RemoteFile
Returns:
link count

getOwner

public String getOwner()
Description copied from interface: RemoteFile
Returns the owner of this file.

Specified by:
getOwner in interface RemoteFile
Returns:
Owner.

getGroup

public String getGroup()
Description copied from interface: RemoteFile
Returns the group name to which the owner of this file belongs to.

Specified by:
getGroup in interface RemoteFile
Returns:
group name.

setAttributes

public void setAttributes(String attributes)
Description copied from interface: RemoteFile
Sets the attributes on this file to the given attributes.

Specified by:
setAttributes in interface RemoteFile
Parameters:
attributes - new attributes to set.

toString

public String toString()
Overrides:
toString in class Object

getOtherProperties

public Hashtable getOtherProperties()
Description copied from interface: RemoteFile
Returns additional properties of this file if any.

Specified by:
getOtherProperties in interface RemoteFile
Returns:
additional properties. May return null if there are no additional properties.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2000-2012 jMethods, Inc.. All Rights Reserved.