Package org.globus.ftp

# Class FileInfo

java.lang.Object
org.globus.ftp.FileInfo

public class FileInfo extends Object
Represents the properties of a remote file such as size, name, modification date and time, etc. Can represent a regular file as well as a directory or a soft link.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final byte`
`DEVICE_TYPE`
`static final byte`
`DIRECTORY_TYPE`
`static final byte`
`FILE_TYPE`
`static final byte`
`SOFTLINK_TYPE`
`static final int`
`UNKNOWN_NUMBER`
`static final String`
`UNKNOWN_STRING`
`static final byte`
`UNKNOWN_TYPE`

## Constructor Summary

Constructors
Constructor
Description
`FileInfo()`
Used internally by the FTPClient.
`FileInfo(String unixListReply)`
Parses the file information from one line of response to the FTP LIST command.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`allCanExecute()`
`boolean`
`allCanRead()`
`boolean`
`allCanWrite()`
`String`
`getDate()`
Returns date of the file.
`int`
`getMode()`
`String`
`getModeAsString()`
`String`
`getName()`
Returns name of the file.
`long`
`getSize()`
Returns size of the file.
`String`
`getTime()`
Returns modification time of the file.
`boolean`
`groupCanExecute()`
`boolean`
`groupCanRead()`
`boolean`
`groupCanWrite()`
`boolean`
`isDevice()`
Tests if this file is a device.
`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.
`void`
`parseUnixListReply(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(String date)`
Sets the file date.
`void`
`setFileType(byte type)`
Sets the file type.
`void`
`setName(String name)`
Sets the file name.
`void`
`setSize(long size)`
Sets the file size.
`void`
`setTime(String time)`
Sets modification time of the file.
`String`
`toString()`
`boolean`
`userCanExecute()`
`boolean`
`userCanRead()`
`boolean`
`userCanWrite()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### UNKNOWN_TYPE

public static final byte UNKNOWN_TYPE

See Also:
  - Constant Field Values

### FILE_TYPE

public static final byte FILE_TYPE

See Also:
  - Constant Field Values

### DIRECTORY_TYPE

public static final byte DIRECTORY_TYPE

See Also:
  - Constant Field Values

### SOFTLINK_TYPE

public static final byte SOFTLINK_TYPE

See Also:
  - Constant Field Values

### DEVICE_TYPE

public static final byte DEVICE_TYPE

See Also:
  - Constant Field Values

### UNKNOWN_STRING

public static final String UNKNOWN_STRING

See Also:
  - Constant Field Values

### UNKNOWN_NUMBER

public static final int UNKNOWN_NUMBER

See Also:
  - Constant Field Values

## Constructor Details

### FileInfo

public FileInfo()
Used internally by the FTPClient.

### FileInfo

public FileInfo(String unixListReply) throws FTPException
Parses the file information from one line of response to the FTP LIST command. Note: There is no commonly accepted standard for the format of LIST response. This parsing method only accepts the most common Unix file listing formats: System V or Berkeley (BSD) 'ls -l'

Parameters:
  `unixListReply` - a single line from ls -l command
Throws:
  `FTPException`
See Also:
  - `parseUnixListReply(String reply)`

## Method Details

### parseUnixListReply

public void parseUnixListReply(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 FTP server format, corresponding to either Unix System V or Berkeley (BSD) output of 'ls -l'. 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

If the entry corresponds to a device file, only the file type will be set and the other parameters will be set to UNKNOWN.

Parameters:
  `reply` - reply of FTP server for "dir" command.
Throws:
  `FTPException` - if unable to parse the reply

### setSize

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

Parameters:
  `size` - size of the file

### setName

public void setName(String name)
Sets the file name.

Parameters:
  `name` - name of the file.

### setDate

public void setDate(String date)
Sets the file date.

Parameters:
  `date` - date of the file.

### setTime

public void setTime(String time)
Sets modification time of the file.

Parameters:
  `time` - time of the file.

### setFileType

public void setFileType(byte type)
Sets the file type.

Parameters:
  `type` - one of the file types, e.g. FILE_TYPE, DIRECTORY_TYPE

### getSize

public long getSize()
Returns size of the file.

Returns:
  size of the file in bytes

### getName

public String getName()
Returns name of the file.

Returns:
  name of the file.

### getDate

public String getDate()
Returns date of the file.

Returns:
  date of the file.

### getTime

public String getTime()
Returns modification 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.

### isDevice

public boolean isDevice()
Tests if this file is a device.

### getMode

public int getMode()

### getModeAsString

public String getModeAsString()

### userCanRead

public boolean userCanRead()

### userCanWrite

public boolean userCanWrite()

### userCanExecute

public boolean userCanExecute()

### groupCanRead

public boolean groupCanRead()

### groupCanWrite

public boolean groupCanWrite()

### groupCanExecute

public boolean groupCanExecute()

### allCanRead

public boolean allCanRead()

### allCanWrite

public boolean allCanWrite()

### allCanExecute

public boolean allCanExecute()

### toString

public String toString()

Overrides:
  `toString` in class `Object`