|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
org.globus.io.ftp
Class FileInfo
java.lang.Object | +--org.globus.io.ftp.FileInfo
- public class FileInfo
- extends java.lang.Object
This class represents a remote ftp file. It contains information such as size, name, creation date and time, etc. It represents both files and directories.
| Field Summary | |
static byte |
DIRECTORY_TYPE
|
static byte |
FILE_TYPE
|
static byte |
SOFTLINK_TYPE
|
static byte |
UNKNOWN_TYPE
|
| Constructor Summary | |
protected |
FileInfo()
Used internally by the FTPClient. |
|
FileInfo(java.lang.String unixListReply)
Parses the file information from ftp dir command. |
| Method Summary | |
java.lang.String |
getDate()
Returns date of the file. |
java.lang.String |
getName()
Returns name of the file. |
long |
getSize()
Returns the size of the file. |
java.lang.String |
getTime()
Returns time of the file. |
boolean |
isDirectory()
Tests if this file is a directory. |
boolean |
isFile()
Tests if this file is a file. |
boolean |
isSoftLink()
Tests if this file is a softlink. |
protected void |
parseUnixListReply(java.lang.String reply)
Given a line of reply received as the result of "LIST" command, this method will set all the attributes(name,size,time,date and file type) of the named file. |
void |
setDate(java.lang.String date)
Sets the date of the file. |
void |
setFileType(byte type)
Sets if the fileType of this file. |
void |
setName(java.lang.String name)
Sets the name of the file. |
void |
setSize(long size)
Sets the size of the file from a string representaion. |
void |
setTime(java.lang.String time)
Sets time of the file. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
UNKNOWN_TYPE
public static final byte UNKNOWN_TYPE
FILE_TYPE
public static final byte FILE_TYPE
DIRECTORY_TYPE
public static final byte DIRECTORY_TYPE
SOFTLINK_TYPE
public static final byte SOFTLINK_TYPE
| Constructor Detail |
FileInfo
protected FileInfo()
- Used internally by the FTPClient.
FileInfo
public FileInfo(java.lang.String unixListReply)
throws FTPException
- Parses the file information from ftp dir command.
(one line only)
- Parameters:
unixListReply- a single line from ls -l command
| Method Detail |
parseUnixListReply
protected void parseUnixListReply(java.lang.String reply)
throws FTPException
- Given a line of reply received as the result of "LIST" command,
this method will set all the attributes(name,size,time,date and file type)
of the named file. This method requires the reply to be in UNIX
(FTP server) format. For example,
drwxr-xr-x 2 guest other 1536 Jan 31 15:15 run.bat
or-rw-rw-r-- 1 globus 117579 Nov 29 13:24 AdGriP.pdf
- Parameters:
reply- reply of FTP server for "dir" command.- Throws:
- if unable to parse the replyFTPException
setSize
public void setSize(long size)
- Sets the size of the file from a string
representaion.
- Parameters:
strSize- size of the file
setName
public void setName(java.lang.String name)
- Sets the name of the file.
- Parameters:
name- name of the file.
setDate
public void setDate(java.lang.String date)
- Sets the date of the file.
- Parameters:
date- date of the file.
setTime
public void setTime(java.lang.String time)
- Sets time of the file.
- Parameters:
time- time of the file.
setFileType
public void setFileType(byte type)
- Sets if the fileType of this file.
- Parameters:
type- one of the file types, e.g. FILE_TYPE, DIRECTORY_TYPE
getSize
public long getSize()
- Returns the size of the file.
- Returns:
- size of the file in bytes.
getName
public java.lang.String getName()
- Returns name of the file.
- Returns:
- name of the file.
getDate
public java.lang.String getDate()
- Returns date of the file.
- Returns:
- date of the file.
getTime
public java.lang.String getTime()
- Returns time of the file.
- Returns:
- time of the file.
isFile
public boolean isFile()
- Tests if this file is a file.
- Returns:
- true if this represents a file, otherwise, false.
isDirectory
public boolean isDirectory()
- Tests if this file is a directory.
- Returns:
- true if this reprensets a directory, otherwise, false.
isSoftLink
public boolean isSoftLink()
- Tests if this file is a softlink.
- Returns:
- true if this reprensets a softlink, otherwise, false.
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||