Class VMSFTPEntryParser
- java.lang.Object
-
- org.apache.commons.net.ftp.FTPFileEntryParserImpl
-
- org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
-
- org.apache.commons.net.ftp.parser.ConfigurableFTPFileEntryParserImpl
-
- org.apache.commons.net.ftp.parser.VMSFTPEntryParser
-
- All Implemented Interfaces:
Configurable
,FTPFileEntryParser
,FTPFileListParser
- Direct Known Subclasses:
VMSVersioningFTPEntryParser
public class VMSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl
Implementation FTPFileEntryParser and FTPFileListParser for VMS Systems. This is a sample of VMS LIST output "1-JUN.LIS;1 9/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,RE)", "1-JUN.LIS;2 9/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,RE)", "DATA.DIR;1 1/9 2-JUN-1998 07:32:04 [GROUP,OWNER] (RWED,RWED,RWED,RE)",Note: VMSFTPEntryParser can only be instantiated through the DefaultFTPParserFactory by classname. It will not be chosen by the autodetection scheme.
- Version:
- $Id: VMSFTPEntryParser.java 155429 2005-02-26 13:13:04Z dirkv $
- Author:
- Winston Ojeda, Steve Cohen, Stephane ESTE-GRACIAS
- See Also:
FTPFileEntryParser (for usage instructions)
,DefaultFTPFileEntryParserFactory
-
-
Field Summary
-
Fields inherited from class org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
_matcher_
-
-
Constructor Summary
Constructors Constructor Description VMSFTPEntryParser()
Constructor for a VMSFTPEntryParser object.VMSFTPEntryParser(FTPClientConfig config)
This constructor allows the creation of a VMSFTPEntryParser object with something other than the default configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FTPClientConfig
getDefaultConfiguration()
Defines a default configuration to be used when this class is instantiated without aFTPClientConfig
parameter being specified.protected boolean
isVersioning()
FTPFile[]
parseFileList(java.io.InputStream listStream)
Parses an FTP server file listing and converts it into a usable format in the form of an array ofFTPFile
instances.FTPFile
parseFTPEntry(java.lang.String entry)
Parses a line of a VMS FTP server file listing and converts it into a usable format in the form of anFTPFile
instance.java.lang.String
readNextEntry(java.io.BufferedReader reader)
Reads the next entry using the supplied BufferedReader object up to whatever delemits one entry from the next.-
Methods inherited from class org.apache.commons.net.ftp.parser.ConfigurableFTPFileEntryParserImpl
configure, parseTimestamp
-
Methods inherited from class org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
getGroupCnt, getGroupsAsString, group, matches
-
Methods inherited from class org.apache.commons.net.ftp.FTPFileEntryParserImpl
parseFileList, preParse
-
-
-
-
Constructor Detail
-
VMSFTPEntryParser
public VMSFTPEntryParser()
Constructor for a VMSFTPEntryParser object.- Throws:
java.lang.IllegalArgumentException
- Thrown if the regular expression is unparseable. Should not be seen under normal conditions. It it is seen, this is a sign thatREGEX
is not a valid regular expression.
-
VMSFTPEntryParser
public VMSFTPEntryParser(FTPClientConfig config)
This constructor allows the creation of a VMSFTPEntryParser object with something other than the default configuration.- Parameters:
config
- Theconfiguration
object used to configure this parser.- Throws:
java.lang.IllegalArgumentException
- Thrown if the regular expression is unparseable. Should not be seen under normal conditions. It it is seen, this is a sign thatREGEX
is not a valid regular expression.- Since:
- 1.4
-
-
Method Detail
-
parseFileList
public FTPFile[] parseFileList(java.io.InputStream listStream) throws java.io.IOException
Parses an FTP server file listing and converts it into a usable format in the form of an array ofFTPFile
instances. If the file list contains no files,null
should be returned, otherwise an array ofFTPFile
instances representing the files in the directory is returned.- Specified by:
parseFileList
in interfaceFTPFileListParser
- Overrides:
parseFileList
in classFTPFileEntryParserImpl
- Parameters:
listStream
- The InputStream from which the file list should be read.- Returns:
- The list of file information contained in the given path. null if the list could not be obtained or if there are no files in the directory.
- Throws:
java.io.IOException
- If an I/O error occurs reading the listStream.
-
parseFTPEntry
public FTPFile parseFTPEntry(java.lang.String entry)
Parses a line of a VMS FTP server file listing and converts it into a usable format in the form of anFTPFile
instance. If the file listing line doesn't describe a file,null
is returned, otherwise aFTPFile
instance representing the files in the directory is returned.- Parameters:
entry
- A line of text from the file listing- Returns:
- An FTPFile instance corresponding to the supplied entry
-
readNextEntry
public java.lang.String readNextEntry(java.io.BufferedReader reader) throws java.io.IOException
Reads the next entry using the supplied BufferedReader object up to whatever delemits one entry from the next. This parser cannot use the default implementation of simply calling BufferedReader.readLine(), because one entry may span multiple lines.- Specified by:
readNextEntry
in interfaceFTPFileEntryParser
- Overrides:
readNextEntry
in classFTPFileEntryParserImpl
- Parameters:
reader
- The BufferedReader object from which entries are to be read.- Returns:
- A string representing the next ftp entry or null if none found.
- Throws:
java.io.IOException
- thrown on any IO Error reading from the reader.
-
isVersioning
protected boolean isVersioning()
-
getDefaultConfiguration
protected FTPClientConfig getDefaultConfiguration()
Defines a default configuration to be used when this class is instantiated without aFTPClientConfig
parameter being specified.- Specified by:
getDefaultConfiguration
in classConfigurableFTPFileEntryParserImpl
- Returns:
- the default configuration for this parser.
-
-