com.ibm.network.ftp
Class FileInfo

java.lang.Object
  |
  +--com.ibm.network.ftp.FileInfo
All Implemented Interfaces:
java.io.Serializable

public class FileInfo
extends java.lang.Object
implements java.io.Serializable

This class stores File information. For each of the file, FTPProtocol class needs to store additional information like size, date and time. This information has to be sent to any User Interface components registered with the FTPProtocol class. This class has getter and setter methods for time, date,size,name and file type. Modified 11/30/99 Andrey Rusak to correctly calculating date and time Servers

See Also:
FTPProtocol, com.ibm.network.ftp.ui.FTPUI, Serialized Form

Constructor Summary
FileInfo()
          Creates an object of FileInfo class.
 
Method Summary
 java.lang.String getDate()
          Returns the last file modification date.
 java.lang.String getName()
          Returns the name of the file.
 java.lang.String getSize()
          Returns the size of the file represented by this FileInfo object.
 java.lang.String getTime()
          Returns the time the file was last modified.
 boolean isFile()
          Returns whether a regular file or directory.
 void setDate(java.lang.String date)
          Set the last modification date of the file.
 void setFile(boolean file)
          Sets the file type (regular file or directory).
 void setLocalDescription(java.lang.String fileName, java.lang.String pathName)
          This method will set the attributes for a local file.
 void setName(java.lang.String fileName)
          Sets the name of the file represented by this FileInfo object.
 void setRemoteDescriptionMVS(java.lang.String reply)
          This method will set attributes for a remote file.
 void setRemoteDescriptionOS400(java.lang.String reply)
           
 void setRemoteDescriptionUNIX(java.lang.String reply)
          This method will set attributes for a remote file.
 void setRemoteDescriptionVM(java.lang.String reply)
          This method will set attributes for a remote file.
 void setSize(java.lang.String size)
          Sets the size of the file represented by this FileInfo object.
 void setTime(java.lang.String time)
          Sets the time of the file represented by this FileInfo object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileInfo

public FileInfo()
Creates an object of FileInfo class. The fields of the FileInfo object are initially null, they must be initialized using appropriate setter methods.
Method Detail

getDate

public java.lang.String getDate()
Returns the last file modification date. The date is returned as a String.
Returns:
the last modified date of the file represented by this FileInfo object.

getName

public java.lang.String getName()
Returns the name of the file. The name of the file that this FileInfo object represents is returned by this method.
Returns:
the name of the file represented by this FileInfo object.

getSize

public java.lang.String getSize()
Returns the size of the file represented by this FileInfo object. The size is returned as a String.
Returns:
the size of the file represented by this FileInfo object.

getTime

public java.lang.String getTime()
Returns the time the file was last modified. The time is returned as a String.
Returns:
the time at which the file represented by this FileObject was last modified.

isFile

public boolean isFile()
Returns whether a regular file or directory. This method identifies the type ( regular file or directory) of the file represented by this FileInfo object.
Returns:
whether the file represented by this FileInfo object is a simple file or directory. true: if it is regular file. false: if it is a directory.

setDate

public void setDate(java.lang.String date)
Set the last modification date of the file. This method will set the date of the file to the String parameter passed as the argument.
Parameters:
date - The last modified date of the file represented by this FileInfo object.

setFile

public void setFile(boolean file)
Sets the file type (regular file or directory). This method will set the file type depending on the boolean argument passed as parameter. If the argument is true then the type is set to regular file. If the argument is false then type is set to directory.
Parameters:
file - whether the file represented by this FileInfo object is a simple file or directory. true: if it is regular file. false: if it is a directory.

setLocalDescription

public void setLocalDescription(java.lang.String fileName,
                                java.lang.String pathName)
This method will set the attributes for a local file. Given the file name and path name as String parameters this method will set all the attributes(name, size,time,date and file type) of the named file.
Parameters:
fileName - name of the file whose description has to be set.
pathName - path of the file whose description has to be set.

setName

public void setName(java.lang.String fileName)
Sets the name of the file represented by this FileInfo object.
Parameters:
fileName - name of the file represented by this FileInfo object.

setRemoteDescriptionMVS

public void setRemoteDescriptionMVS(java.lang.String reply)
This method will set attributes for a remote file. Given a line of reply received as the result of "LIST" command, this method will set all the attributes(name, size,time and date) of the named file. This method requires the reply to be in MVS (??) format. For example, "SMS015 3390 1999/07/13 1 2 FB 80 23440 PO ISPF.ISPPROF" And this can be a problem, because the Used column can run into the Ext column: "SMSX09 3390 1999/07/15 117069 FB 2048 26624 PS #TESTDAT.#1234" Note for the record that MVS may also migrate a dataset, i.e.: "Migrated LOG.MISC" is a possible response to the system. Of course, the system also writes files directly to tape, a la: "P01479 Tape THISN.THAT"
Parameters:
reply - reply of FTP server for "dir" command.

setRemoteDescriptionUNIX

public void setRemoteDescriptionUNIX(java.lang.String reply)
This method will set attributes for a remote file. 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"
Parameters:
reply - reply of FTP server for "dir" command.

setRemoteDescriptionVM

public void setRemoteDescriptionVM(java.lang.String reply)
This method will set attributes for a remote file. Given a line of reply received as the result of "LIST" command, this method will set all the attributes(name, size,time and date) of the named file. This method requires the reply to be in VM (FTP server) format. For example, " GATEWAY RULES V 76 86 1 1/17/98 22:30:59 ADISK"
Parameters:
reply - reply of FTP server for "dir" command.

setRemoteDescriptionOS400

public void setRemoteDescriptionOS400(java.lang.String reply)

setSize

public void setSize(java.lang.String size)
Sets the size of the file represented by this FileInfo object. This method sets the size of the file to the argument passed to it as a String.
Parameters:
size - size of the file represented by this FileInfo object.

setTime

public void setTime(java.lang.String time)
Sets the time of the file represented by this FileInfo object. It takes a string argument.
Parameters:
time - time at which the file represented by this FileInfo object was last modified.