it.sauronsoftware.ftp4j
Class FTPFile

java.lang.Object
  extended by it.sauronsoftware.ftp4j.FTPFile

public class FTPFile
extends java.lang.Object

The instances of this class represents the files in a remote FTP directory.

Author:
Carlo Pelliccia

Field Summary
static int TYPE_DIRECTORY
          The value for the type "directory".
static int TYPE_FILE
          The value for the type "file".
static int TYPE_LINK
          The value for the type "link".
 
Constructor Summary
FTPFile()
           
 
Method Summary
 java.lang.String getLink()
          This method returns the path of the linked file, if this one is a link.
 java.util.Date getModifiedDate()
          Returns the last modified date of the file.
 java.lang.String getName()
          Returns the name of the file.
 long getSize()
          Returns the size of the file (bytes).
 int getType()
          Returns the type of the entry represented.
 void setLink(java.lang.String link)
          This method sets the path of the linked file, if this one is a link.
 void setModifiedDate(java.util.Date modifiedDate)
          Sets the last modified date of the file.
 void setName(java.lang.String name)
          Sets the name of the file.
 void setSize(long size)
          Sets the size of the file (bytes).
 void setType(int type)
          Sets the type of the entry represented.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_FILE

public static final int TYPE_FILE
The value for the type "file".

See Also:
Constant Field Values

TYPE_DIRECTORY

public static final int TYPE_DIRECTORY
The value for the type "directory".

See Also:
Constant Field Values

TYPE_LINK

public static final int TYPE_LINK
The value for the type "link".

See Also:
Constant Field Values
Constructor Detail

FTPFile

public FTPFile()
Method Detail

getModifiedDate

public java.util.Date getModifiedDate()
Returns the last modified date of the file. Pay attention: it could be null if the information is not supplied by the server.

Returns:
The last modified date of the file, or null if the information is not supplied.

setModifiedDate

public void setModifiedDate(java.util.Date modifiedDate)
Sets the last modified date of the file.

Parameters:
modifiedDate - The last modified date of the file.

getName

public java.lang.String getName()
Returns the name of the file.

Returns:
The name of the file.

setName

public void setName(java.lang.String name)
Sets the name of the file.

Parameters:
name - The name of the file.

getType

public int getType()
Returns the type of the entry represented. It must be TYPE_FILE, TYPE_DIRECTORY or TYPE_LINK.

Returns:
The type of the entry represented. It must be TYPE_FILE, TYPE_DIRECTORY or TYPE_LINK.

setType

public void setType(int type)
Sets the type of the entry represented. It can be TYPE_FILE, TYPE_DIRECTORY or TYPE_LINK.

Parameters:
type - The type of the entry represented. It can be TYPE_FILE, TYPE_DIRECTORY or TYPE_LINK.

getSize

public long getSize()
Returns the size of the file (bytes). A negative value is returned if the information is not available.

Returns:
The size of the file (bytes). A negative value is returned if the information is not available.

setSize

public void setSize(long size)
Sets the size of the file (bytes).

Parameters:
size - The size of the file (bytes).

getLink

public java.lang.String getLink()
This method returns the path of the linked file, if this one is a link. If this is not a link, or if the information is not available, it returns null.

Returns:
The path of the linked file, if this one is a link. If this is not a link, or if the information is not available, it returns null.

setLink

public void setLink(java.lang.String link)
This method sets the path of the linked file, if this one is a link.

Parameters:
link - The path of the linked file, if this one is a link.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object