FTP list parser
This module is designed to parse FTP directory listings, returning a list of objects that represent files and directories.
Currently, the module can read the following types of FTP server listings :
- Unix / Linux
- Enterprise Unix
- Netware
- NT
- OS2
- OS400
- MVS
- VMS
Requirements
The BaH.RegEx module is required for list processing.
Usage
Create an instance of TFTPParserFactory, and use the parseList() method to parse the listing, returning a TList of TFilePath objects.
The listing should be passed in as a single String.
Types Summary
Types
| Type TFileAttributes |
| Description | File attributes. |
| Field fType:Int |
| Description | The file type. |
| Information | One of, FTP_TYPE_FILE, FTP_TYPE_DIRECTORY or FTP_TYPE_SYMBOLIC_LINK. |
| Field group:String |
| Description | The group, if available. |
| Field modified:TFTPDateTime |
| Description | The timestamp, if available. |
| Field owner:String |
| Description | The owner/user, if available. |
| Field permissions:TFilePermissions |
| Description | The file permissions, if available. |
| Field size:Long |
| Description | The file size. |
| Type TFilePath |
| Description | A specific File/Directory/Symbolic Link. |
| Methods Summary |
| isDir |
Returns true if this is a directory.
|
| isFile |
Returns True if this is a file.
|
| isSymbolic |
Returns True if this is a symbolic link.
|
| Field absolutePath:String |
| Description | The absolute path of this TFilePath. |
| Field attributes:TFileAttributes |
| Description | The attributes. |
| Information | See TFileAttributes. |
| Field name:String |
| Description | The name of this TFilePath. |
| Field symbolic:String |
| Description | The symbolic link that this TFilePath points to, if appropriate. |
| Method isDir:Int() |
| Description | Returns true if this is a directory. |
| Method isFile:Int() |
| Description | Returns True if this is a file. |
| Method isSymbolic:Int() |
| Description | Returns True if this is a symbolic link. |
| Function Create:TFilePath(parent:TFilePath = Null) |
| Description | Creates a new TFilePath, with an option parent. |
| Information | The parent will deteremine the proper absolutePath value. |
| Type TFilePermissions |
| Description | File Permissions. |
| Type TFTPDateTime |
| Description | A date-time representation for FTP files and directories. |
| Type TFTPParserFactory |
| Description | Tries to determine the FTP server kind based on directory list, and provides a parser for it. |
| Information | Current FTP servers supported : Unix, Netware, Enterprise Unix, NT, MVS, OS2, OS400 and VMS. |
| Methods Summary |
| clearCache |
Clears the parser cache, forcing it to re-test the next time parseList is invoked.
|
| parseList |
Parse the directory list (as a multi-line String)
|
| Method clearCache() |
| Description | Clears the parser cache, forcing it to re-test the next time parseList is invoked. |
| Method parseList:TList(parent:TFilePath, list:String) |
| Description | Parse the directory list (as a multi-line String) |
| Information | Will try different parsers until it finds one that works on the list.
Once found, it reuses that specific parser from that point on every call to this method. |
| Function Create:TFTPParserFactory() |
| Description | Creates a new TFTPParserFactory object. |
Module Information
| Version | 1.00 |
| Author | Bruce A Henderson |
| License | Apache 2.0 |
| Copyright | 2007 Bruce A Henderson |
| Modserver | BRL |
| History | 1.00 |
| History | Based on Apache Commons FTP Parsers and Cyberduck source |