ORO, Inc. Logo  All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.oroinc.net.ftp.FTPFile

java.lang.Object
   |
   +----com.oroinc.net.ftp.FTPFile

public class FTPFile
extends Object
implements Serializable
The FTPFile class is used to represent information about files stored on an FTP server. Because there is no standard representation for file information on FTP servers, it may not always be possible to extract all the information that can be represented by FTPFile, or it may even be possible to extract more information. In cases where more information can be extracted, you will want to subclass FTPFile and implement your own FTPFileListParser to extract the information. However, most FTP servers return file information in a format that can be completely parsed by DefaultFTPFileListParser and stored in FTPFile.

Copyright © 1997 Original Reusable Objects, Inc. All rights reserved.

See Also:
FTPFileListParser, DefaultFTPFileListParser, listFiles

Variable Index

 o DIRECTORY_TYPE
A constant indicating an FTPFile is a directory.
 o EXECUTE_PERMISSION
A constant indicating file execute permission or directory listing permission.
 o FILE_TYPE
A constant indicating an FTPFile is a file.
 o GROUP_ACCESS
A constant indicating group access permissions.
 o READ_PERMISSION
A constant indicating file/directory read permission.
 o SYMBOLIC_LINK_TYPE
A constant indicating an FTPFile is a symbolic link.
 o UNKNOWN_TYPE
A constant indicating an FTPFile is of unknown type.
 o USER_ACCESS
A constant indicating user access permissions.
 o WORLD_ACCESS
A constant indicating world access permissions.
 o WRITE_PERMISSION
A constant indicating file/directory write permission.

Constructor Index

 o FTPFile()
Creates an empty FTPFile.

Method Index

 o getGroup()
Returns the name of the group owning the file.
 o getHardLinkCount()
Return the number of hard links to this file.
 o getLink()
If the FTPFile is a symbolic link, this method returns the name of the file being pointed to by the symbolic link.
 o getName()
Return the name of the file.
 o getRawListing()
Get the original FTP server raw listing used to initialize the FTPFile.
 o getSize()
Return the file size in bytes.
 o getTimestamp()
Returns the file timestamp.
 o getType()
Return the type of the file (one of the _TYPE constants), e.g., if it is a directory, a regular file, or a symbolic link.
 o getUser()
Returns the name of the user owning the file.
 o hasPermission(int, int)
Determines if the given access group (one of the _ACCESS constants) has the given access permission (one of the _PERMISSION constants) to the file.
 o isDirectory()
Determine if the file is a directory.
 o isFile()
Determine if the file is a regular file.
 o isSymbolicLink()
Determine if the file is a symbolic link.
 o isUnknown()
Determine if the type of the file is unknown.
 o setGroup(String)
Set the name of the group owning the file.
 o setHardLinkCount(int)
Set the number of hard links to this file.
 o setLink(String)
If the FTPFile is a symbolic link, use this method to set the name of the file being pointed to by the symbolic link.
 o setName(String)
Set the name of the file.
 o setPermission(int, int, boolean)
Set if the given access group (one of the _ACCESS constants) has the given access permission (one of the _PERMISSION constants) to the file.
 o setRawListing(String)
Set the original FTP server raw listing from which the FTPFile was created.
 o setSize(long)
Set the file size in bytes.
 o setTimestamp(Calendar)
Set the file timestamp.
 o setType(int)
Set the type of the file (DIRECTORY_TYPE, FILE_TYPE, etc.).
 o setUser(String)
Set the name of the user owning the file.
 o toString()
Returns a string representation of the FTPFile information.

Variables

 o FILE_TYPE
 public static final int FILE_TYPE
A constant indicating an FTPFile is a file.

 o DIRECTORY_TYPE
 public static final int DIRECTORY_TYPE
A constant indicating an FTPFile is a directory.

 o SYMBOLIC_LINK_TYPE
 public static final int SYMBOLIC_LINK_TYPE
A constant indicating an FTPFile is a symbolic link.

 o UNKNOWN_TYPE
 public static final int UNKNOWN_TYPE
A constant indicating an FTPFile is of unknown type.

 o USER_ACCESS
 public static final int USER_ACCESS
A constant indicating user access permissions.

 o GROUP_ACCESS
 public static final int GROUP_ACCESS
A constant indicating group access permissions.

 o WORLD_ACCESS
 public static final int WORLD_ACCESS
A constant indicating world access permissions.

 o READ_PERMISSION
 public static final int READ_PERMISSION
A constant indicating file/directory read permission.

 o WRITE_PERMISSION
 public static final int WRITE_PERMISSION
A constant indicating file/directory write permission.

 o EXECUTE_PERMISSION
 public static final int EXECUTE_PERMISSION
A constant indicating file execute permission or directory listing permission.

Constructors

 o FTPFile
 public FTPFile()
Creates an empty FTPFile.

Methods

 o setRawListing
 public void setRawListing(String rawListing)
Set the original FTP server raw listing from which the FTPFile was created.

Parameters:
rawListing - The raw FTP server listing.
 o getRawListing
 public String getRawListing()
Get the original FTP server raw listing used to initialize the FTPFile.

Returns:
The original FTP server raw listing used to initialize the FTPFile.
 o isDirectory
 public boolean isDirectory()
Determine if the file is a directory.

Returns:
True if the file is of type DIRECTORY_TYPE, false if not.
 o isFile
 public boolean isFile()
Determine if the file is a regular file.

Returns:
True if the file is of type FILE_TYPE, false if not.
 o isSymbolicLink
 public boolean isSymbolicLink()
Determine if the file is a symbolic link.

Returns:
True if the file is of type UNKNOWN_TYPE, false if not.
 o isUnknown
 public boolean isUnknown()
Determine if the type of the file is unknown.

Returns:
True if the file is of type UNKNOWN_TYPE, false if not.
 o setType
 public void setType(int type)
Set the type of the file (DIRECTORY_TYPE, FILE_TYPE, etc.).

Parameters:
type - The integer code representing the type of the file.
 o getType
 public int getType()
Return the type of the file (one of the _TYPE constants), e.g., if it is a directory, a regular file, or a symbolic link.

Returns:
The type of the file.
 o setName
 public void setName(String name)
Set the name of the file.

Parameters:
name - The name of the file.
 o getName
 public String getName()
Return the name of the file.

Returns:
The name of the file.
 o setSize
 public void setSize(long size)
Set the file size in bytes.

Parameters:
The - file size in bytes.
 o getSize
 public long getSize()
Return the file size in bytes.

Returns:
The file size in bytes.
 o setHardLinkCount
 public void setHardLinkCount(int links)
Set the number of hard links to this file. This is not to be confused with symbolic links.

Parameters:
links - The number of hard links to this file.
 o getHardLinkCount
 public int getHardLinkCount()
Return the number of hard links to this file. This is not to be confused with symbolic links.

Returns:
The number of hard links to this file.
 o setGroup
 public void setGroup(String group)
Set the name of the group owning the file. This may be a string representation of the group number.

Parameters:
group - The name of the group owning the file.
 o getGroup
 public String getGroup()
Returns the name of the group owning the file. Sometimes this will be a string representation of the group number.

Returns:
The name of the group owning the file.
 o setUser
 public void setUser(String user)
Set the name of the user owning the file. This may be a string representation of the user number;

Parameters:
user - The name of the user owning the file.
 o getUser
 public String getUser()
Returns the name of the user owning the file. Sometimes this will be a string representation of the user number.

Returns:
The name of the user owning the file.
 o setLink
 public void setLink(String link)
If the FTPFile is a symbolic link, use this method to set the name of the file being pointed to by the symbolic link.

Parameters:
link - The file pointed to by the symbolic link.
 o getLink
 public String getLink()
If the FTPFile is a symbolic link, this method returns the name of the file being pointed to by the symbolic link. Otherwise it returns null.

Returns:
The file pointed to by the symbolic link (null if the FTPFile is not a symbolic link).
 o setTimestamp
 public void setTimestamp(Calendar date)
Set the file timestamp. This usually the last modification time. The parameter is not cloned, so do not alter its value after calling this method.

Parameters:
date - A Calendar instance representing the file timestamp.
 o getTimestamp
 public Calendar getTimestamp()
Returns the file timestamp. This usually the last modification time.

Returns:
A Calendar instance representing the file timestamp.
 o setPermission
 public void setPermission(int access,
                           int permission,
                           boolean value)
Set if the given access group (one of the _ACCESS constants) has the given access permission (one of the _PERMISSION constants) to the file.

Parameters:
access - The access group (one of the _ACCESS constants)
permission - The access permission (one of the _PERMISSION constants)
value - True if permission is allowed, false if not.
 o hasPermission
 public boolean hasPermission(int access,
                              int permission)
Determines if the given access group (one of the _ACCESS constants) has the given access permission (one of the _PERMISSION constants) to the file.

Parameters:
access - The access group (one of the _ACCESS constants)
permission - The access permission (one of the _PERMISSION constants)
 o toString
 public String toString()
Returns a string representation of the FTPFile information. This will be the raw FTP server listing that was used to initialize the FTPFile instance.

Returns:
A string representation of the FTPFile information.
Overrides:
toString in class Object

ORO, Inc. Logo  All Packages  Class Hierarchy  This Package  Previous  Next  Index