Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.commons.net.ftp.FTPFile
public class FTPFile
extends java.lang.Object
implements Serializable
org.apache.commons.net.ftp.FTPFileListParser
to extract the information.
However, most FTP servers return file information in a format that
can be completely parsed by
org.apache.commons.net.ftp.DefaultFTPFileListParser
and stored in FTPFile.
FTPFileListParser
, DefaultFTPFileListParser
, FTPClient.listFiles
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
Constructor Summary | |
|
Method Summary | |
@Override |
|
String |
|
int |
|
String |
|
String |
|
String |
|
long |
|
Calendar |
|
int |
|
String |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public static final int DIRECTORY_TYPE
A constant indicating an FTPFile is a directory. **
- Field Value:
- 1
public static final int EXECUTE_PERMISSION
A constant indicating file execute permission or directory listing permission.
- Field Value:
- 2
public static final int FILE_TYPE
A constant indicating an FTPFile is a file. **
- Field Value:
- 0
public static final int GROUP_ACCESS
A constant indicating group access permissions. **
- Field Value:
- 1
public static final int READ_PERMISSION
A constant indicating file/directory read permission. **
- Field Value:
- 0
public static final int SYMBOLIC_LINK_TYPE
A constant indicating an FTPFile is a symbolic link. **
- Field Value:
- 2
public static final int UNKNOWN_TYPE
A constant indicating an FTPFile is of unknown type. **
- Field Value:
- 3
public static final int USER_ACCESS
A constant indicating user access permissions. **
- Field Value:
- 0
public static final int WORLD_ACCESS
A constant indicating world access permissions. **
- Field Value:
- 2
public static final int WRITE_PERMISSION
A constant indicating file/directory write permission. **
- Field Value:
- 1
public @Override 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.
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.
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.
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).
public String getName()
Return the name of the file.
- Returns:
- The name of the file.
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.
public long getSize()
Return the file size in bytes.
- Returns:
- The file size in bytes.
public Calendar getTimestamp()
Returns the file timestamp. This usually the last modification time.
- Returns:
- A Calendar instance representing the file timestamp.
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.
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.
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)
public boolean isDirectory()
Determine if the file is a directory.
- Returns:
- True if the file is of type
DIRECTORY_TYPE
, false if not.
public boolean isFile()
Determine if the file is a regular file.
- Returns:
- True if the file is of type
FILE_TYPE
, false if not.
public boolean isSymbolicLink()
Determine if the file is a symbolic link.
- Returns:
- True if the file is of type
UNKNOWN_TYPE
, false if not.
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.
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.
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.
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.
public void setName(String name)
Set the name of the file.
- Parameters:
name
- The name of the file.
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.
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.
public void setSize(long size)
Set the file size in bytes.
- Parameters:
size
- The file size in bytes.
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.
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.
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.