Secure FTP Factory

com.jscape.inet.ftp
Class FtpFile

java.lang.Object
  extended by com.jscape.inet.ftp.FtpFile
All Implemented Interfaces:
java.io.Serializable

public class FtpFile
extends java.lang.Object
implements java.io.Serializable

Represents an item in a directory listing retrieved from FTP server.

See Also:
Serialized Form

Constructor Summary
FtpFile(java.lang.String filename)
          Creates a new FtpFile instance.
FtpFile(java.lang.String filename, FtpFileParser ftpFileParser)
          Creates a new FtpFile instance.
FtpFile(java.lang.String filename, long filesize, java.lang.String owner, java.lang.String group, java.lang.String permission, java.lang.String fileDate, java.lang.String fileTime, boolean directory, boolean link, java.lang.String linkTarget, int style, java.lang.String line)
          Creates a new FtpFile instance.
FtpFile(java.lang.String filename, long filesize, java.lang.String owner, java.lang.String group, java.lang.String permission, java.lang.String fileDate, java.lang.String fileTime, boolean directory, boolean link, java.lang.String linkTarget, int style, java.lang.String line, boolean isYearSet)
          Creates a new FtpFile instance.
FtpFile(java.lang.String filename, java.lang.String line, FtpFileParser ftpFileParser)
          Creates a new FtpFile instance.
 
Method Summary
 java.lang.String getDate()
          Gets date for this FtpFile.
 java.lang.String getFilename()
          Gets filename for this FtpFile.
 long getFilesize()
          Gets file size for this FtpFile.
 FtpFileParser getFtpFileParser()
          Gets the FtpFileParser that created this FtpFile
 java.lang.String getGroup()
          Gets group for this FtpFile.
 java.lang.String getLine()
          Gets the original line sent by FTP server and used in parsing this FtpFile
 java.lang.String getLinkTarget()
          If the directory listing entry for this file is a link and link target is specified by the server, this method can be used to retrieve the link target.
 java.lang.String getOwner()
          Gets owner of this FtpFile.
 java.lang.String getPermission()
          Gets permissions string for this FtpFile.
 java.lang.String getTime()
          Gets time for this FtpFile.
 boolean isDirectory()
          Test if this file represents a directory on the server.
 boolean isHidden()
          Checks where the filename is a hidden filename by checking to see if filename begins with a period.
 boolean isLink()
          Test wheather the entity represented by this FtpFile object is a symbolic link.
 boolean isYearSet()
          Is year set.
 void setDate(java.lang.String fileDate)
          Sets date for this FtpFile.
 void setDirectory(boolean isDirectory)
          Denotes file as a directory.
 void setFilename(java.lang.String filename)
          Sets filename for this FtpFile.
 void setFilesize(java.lang.String size)
          Sets file size for this FtpFile.
 void setFtpFileParser(FtpFileParser value)
           
 void setGroup(java.lang.String group)
          Sets group for this FtpFile.
 void setLine(java.lang.String line)
          Sets the original line sent by FTP server and used in parsing this FtpFile
 void setLinkTarget(java.lang.String s)
          Set the target if this entry is a link.
 void setOwner(java.lang.String owner)
          Sets owner of this FtpFile.
 void setPermission(java.lang.String permission)
          Sets permissions string for this FtpFile.
 void setTime(java.lang.String fileTime)
          Sets time for this FtpFile.
 java.lang.String toString()
          Gets string representation of this FtpFile.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FtpFile

public FtpFile(java.lang.String filename,
               long filesize,
               java.lang.String owner,
               java.lang.String group,
               java.lang.String permission,
               java.lang.String fileDate,
               java.lang.String fileTime,
               boolean directory,
               boolean link,
               java.lang.String linkTarget,
               int style,
               java.lang.String line)
Creates a new FtpFile instance.

Parameters:
filename - the name of the file
filesize - the size of the file
owner - the owner or owner id of the file
group - the group or group id of the file
permission - the permissions for the file
fileDate - the last modified date of the file
fileTime - the last modified time of the file
directory - true if is a directory
link - true if is a symbolic link
linkTarget - the target if a symbolic link
style - the directory listing style used
line - the original line used to generate this entry

FtpFile

public FtpFile(java.lang.String filename,
               long filesize,
               java.lang.String owner,
               java.lang.String group,
               java.lang.String permission,
               java.lang.String fileDate,
               java.lang.String fileTime,
               boolean directory,
               boolean link,
               java.lang.String linkTarget,
               int style,
               java.lang.String line,
               boolean isYearSet)
Creates a new FtpFile instance.

Parameters:
filename - the name of the file
filesize - the size of the file
owner - the owner or owner id of the file
group - the group or group id of the file
permission - the permissions for the file
fileDate - the last modified date of the file
fileTime - the last modified time of the file
directory - true if is a directory
link - true if is a symbolic link
linkTarget - the target if a symbolic link
style - the directory listing style used
line - the original line used to generate this entry

FtpFile

public FtpFile(java.lang.String filename)
Creates a new FtpFile instance.

Parameters:
filename - the name of file

FtpFile

public FtpFile(java.lang.String filename,
               java.lang.String line,
               FtpFileParser ftpFileParser)
Creates a new FtpFile instance.

Parameters:
filename - the name of file
line - the original line sent by FTP server and used in parsing this FtpFile

FtpFile

public FtpFile(java.lang.String filename,
               FtpFileParser ftpFileParser)
Creates a new FtpFile instance.

Parameters:
filename - the name of file
ftpFileParser - the FtpFileParser that created this FtpFile
See Also:
FtpFileParser
Method Detail

isYearSet

public boolean isYearSet()
Is year set.

Returns:

setFilename

public void setFilename(java.lang.String filename)
Sets filename for this FtpFile.

Parameters:
filename - the name of file

getFilename

public java.lang.String getFilename()
Gets filename for this FtpFile.

Returns:
filename

setFilesize

public void setFilesize(java.lang.String size)
Sets file size for this FtpFile.

Parameters:
size - the size of file in bytes

getFilesize

public long getFilesize()
Gets file size for this FtpFile.

Returns:
size of file in bytes

setOwner

public void setOwner(java.lang.String owner)
Sets owner of this FtpFile.

Parameters:
owner - the name of owner

getOwner

public java.lang.String getOwner()
Gets owner of this FtpFile.

Returns:
name of owner

setGroup

public void setGroup(java.lang.String group)
Sets group for this FtpFile.

Parameters:
group - the name of group

getGroup

public java.lang.String getGroup()
Gets group for this FtpFile.

Returns:
name of group

setPermission

public void setPermission(java.lang.String permission)
Sets permissions string for this FtpFile.

Parameters:
permission - a permissions string

getPermission

public java.lang.String getPermission()
Gets permissions string for this FtpFile. The permissions string usually has the standard unix form, such as:
For a directory: drwxr-xr-x
For a file: -rw-rw-r--
For a link: lrw-r--r--

Returns:
a permissions string
See Also:
isDirectory, isLink, getLinkTarget()

isDirectory

public boolean isDirectory()
Test if this file represents a directory on the server. Assumes is a directory if is a symbolic link and has no periods in filename.

Returns:
true if is a directory false otherwise
See Also:
isLink

setDirectory

public void setDirectory(boolean isDirectory)
Denotes file as a directory. Normally this will be set automatically by parsing the permissions for the file. This method is useful in cases where permissions information is not included for example MS-DOS.

Parameters:
isDirectory - true if file is a directory false otherwise

isLink

public boolean isLink()
Test wheather the entity represented by this FtpFile object is a symbolic link.

Returns:
true if is a symbolic link false otherwise
See Also:
getLinkTarget()

setLinkTarget

public void setLinkTarget(java.lang.String s)
Set the target if this entry is a link.

Parameters:
s - the link target path name

getLinkTarget

public java.lang.String getLinkTarget()
If the directory listing entry for this file is a link and link target is specified by the server, this method can be used to retrieve the link target.

Returns:
the target of symbolic link
See Also:
isLink

setDate

public void setDate(java.lang.String fileDate)
Sets date for this FtpFile.

Parameters:
fileDate - the date of the file

getDate

public java.lang.String getDate()
Gets date for this FtpFile.

Returns:
a date

setTime

public void setTime(java.lang.String fileTime)
Sets time for this FtpFile.

Parameters:
fileTime - of the file

getTime

public java.lang.String getTime()
Gets time for this FtpFile.

Returns:
a time

toString

public java.lang.String toString()
Gets string representation of this FtpFile.

Overrides:
toString in class java.lang.Object
Returns:
a String

isHidden

public boolean isHidden()
Checks where the filename is a hidden filename by checking to see if filename begins with a period.

Returns:
true if hidden, false otherwise

getFtpFileParser

public FtpFileParser getFtpFileParser()
Gets the FtpFileParser that created this FtpFile

Returns:
a FtpFileParser

setFtpFileParser

public void setFtpFileParser(FtpFileParser value)

setLine

public void setLine(java.lang.String line)
Sets the original line sent by FTP server and used in parsing this FtpFile

Parameters:
line - the original line

getLine

public java.lang.String getLine()
Gets the original line sent by FTP server and used in parsing this FtpFile

Returns:
the original line

Secure FTP Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved