|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.oroinc.net.ftp.FTPFile
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.
FTPFileListParser
,
DefaultFTPFileListParser
,
FTPClient.listFiles(com.oroinc.net.ftp.FTPFileListParser, java.lang.String)
, Serialized FormField Summary | |
static int |
DIRECTORY_TYPE
A constant indicating an FTPFile is a directory. |
static int |
EXECUTE_PERMISSION
A constant indicating file execute permission or directory listing permission. |
static int |
FILE_TYPE
A constant indicating an FTPFile is a file. |
static int |
GROUP_ACCESS
A constant indicating group access permissions. |
static int |
READ_PERMISSION
A constant indicating file/directory read permission. |
static int |
SYMBOLIC_LINK_TYPE
A constant indicating an FTPFile is a symbolic link. |
static int |
UNKNOWN_TYPE
A constant indicating an FTPFile is of unknown type. |
static int |
USER_ACCESS
A constant indicating user access permissions. |
static int |
WORLD_ACCESS
A constant indicating world access permissions. |
static int |
WRITE_PERMISSION
A constant indicating file/directory write permission. |
Constructor Summary | |
FTPFile()
Creates an empty FTPFile. |
Method Summary | |
java.lang.String |
getGroup()
Returns the name of the group owning the file. |
int |
getHardLinkCount()
Return the number of hard links to this file. |
java.lang.String |
getLink()
If the FTPFile is a symbolic link, this method returns the name of the file being pointed to by the symbolic link. |
java.lang.String |
getName()
Return the name of the file. |
java.lang.String |
getRawListing()
Get the original FTP server raw listing used to initialize the FTPFile. |
long |
getSize()
Return the file size in bytes. |
java.util.Calendar |
getTimestamp()
Returns the file timestamp. |
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. |
java.lang.String |
getUser()
Returns the name of the user owning the file. |
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. |
boolean |
isDirectory()
Determine if the file is a directory. |
boolean |
isFile()
Determine if the file is a regular file. |
boolean |
isSymbolicLink()
Determine if the file is a symbolic link. |
boolean |
isUnknown()
Determine if the type of the file is unknown. |
void |
setGroup(java.lang.String group)
Set the name of the group owning the file. |
void |
setHardLinkCount(int links)
Set the number of hard links to this file. |
void |
setLink(java.lang.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. |
void |
setName(java.lang.String name)
Set the name of the file. |
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. |
void |
setRawListing(java.lang.String rawListing)
Set the original FTP server raw listing from which the FTPFile was created. |
void |
setSize(long size)
Set the file size in bytes. |
void |
setTimestamp(java.util.Calendar date)
Set the file timestamp. |
void |
setType(int type)
Set the type of the file ( DIRECTORY_TYPE ,
FILE_TYPE , etc.). |
void |
setUser(java.lang.String user)
Set the name of the user owning the file. |
java.lang.String |
toString()
Returns a string representation of the FTPFile information. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int FILE_TYPE
public static final int DIRECTORY_TYPE
public static final int SYMBOLIC_LINK_TYPE
public static final int UNKNOWN_TYPE
public static final int USER_ACCESS
public static final int GROUP_ACCESS
public static final int WORLD_ACCESS
public static final int READ_PERMISSION
public static final int WRITE_PERMISSION
public static final int EXECUTE_PERMISSION
Constructor Detail |
public FTPFile()
Method Detail |
public void setRawListing(java.lang.String rawListing)
rawListing
- The raw FTP server listing.public java.lang.String getRawListing()
public boolean isDirectory()
DIRECTORY_TYPE
, false if
not.public boolean isFile()
FILE_TYPE
, false if
not.public boolean isSymbolicLink()
UNKNOWN_TYPE
, false if
not.public boolean isUnknown()
UNKNOWN_TYPE
, false if
not.public void setType(int type)
DIRECTORY_TYPE
,
FILE_TYPE
, etc.).
type
- The integer code representing the type of the file.public int getType()
_TYPE
constants),
e.g., if it is a directory, a regular file, or a symbolic link.
public void setName(java.lang.String name)
name
- The name of the file.public java.lang.String getName()
public void setSize(long size)
The
- file size in bytes.public long getSize()
public void setHardLinkCount(int links)
links
- The number of hard links to this file.public int getHardLinkCount()
public void setGroup(java.lang.String group)
group
- The name of the group owning the file.public java.lang.String getGroup()
public void setUser(java.lang.String user)
user
- The name of the user owning the file.public java.lang.String getUser()
public void setLink(java.lang.String link)
link
- The file pointed to by the symbolic link.public java.lang.String getLink()
public void setTimestamp(java.util.Calendar date)
date
- A Calendar instance representing the file timestamp.public java.util.Calendar getTimestamp()
public void setPermission(int access, int permission, boolean value)
_ACCESS
constants) has the given access permission (one of the
_PERMISSION
constants) to the file.
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 boolean hasPermission(int access, int permission)
_ACCESS
constants) has the given access permission (one of the
_PERMISSION
constants) to the file.
access
- The access group (one of the _ACCESS
constants)permission
- The access permission (one of the
_PERMISSION
constants)public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |