Package org.apache.commons.net.ftp
Class FTPFileEntryParserImpl
- java.lang.Object
-
- org.apache.commons.net.ftp.FTPFileEntryParserImpl
-
- All Implemented Interfaces:
FTPFileEntryParser
,FTPFileListParser
- Direct Known Subclasses:
CompositeFileEntryParser
,RegexFTPFileEntryParserImpl
public abstract class FTPFileEntryParserImpl extends java.lang.Object implements FTPFileEntryParser, FTPFileListParser
This abstract class implements both the older FTPFileListParser and newer FTPFileEntryParser interfaces with default functionality. All the classes in the parser subpackage inherit from this.
-
-
Constructor Summary
Constructors Constructor Description FTPFileEntryParserImpl()
The constructor for a FTPFileEntryParserImpl object.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FTPFile[]
parseFileList(java.io.InputStream listStream)
Deprecated.The version of this method which takes an encoding should be used.FTPFile[]
parseFileList(java.io.InputStream listStream, java.lang.String encoding)
Parses an FTP server file listing and converts it into a usable format in the form of an array ofFTPFile
instances.java.util.List
preParse(java.util.List original)
This method is a hook for those implementors (such as VMSVersioningFTPEntryParser, and possibly others) which need to perform some action upon the FTPFileList after it has been created from the server stream, but before any clients see the list.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.net.ftp.FTPFileEntryParser
parseFTPEntry
-
-
-
-
Method Detail
-
parseFileList
public FTPFile[] parseFileList(java.io.InputStream listStream, java.lang.String encoding) 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
- Parameters:
listStream
- The InputStream from which the file list should be read.encoding
- The encoding to use.- 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.
-
parseFileList
public FTPFile[] parseFileList(java.io.InputStream listStream) throws java.io.IOException
Deprecated.The version of this method which takes an encoding should be used.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
- 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.
-
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 default implementation simply calls BufferedReader.readLine().- Specified by:
readNextEntry
in interfaceFTPFileEntryParser
- 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.
-
preParse
public java.util.List preParse(java.util.List original)
This method is a hook for those implementors (such as VMSVersioningFTPEntryParser, and possibly others) which need to perform some action upon the FTPFileList after it has been created from the server stream, but before any clients see the list. This default implementation is a no-op.- Specified by:
preParse
in interfaceFTPFileEntryParser
- Parameters:
original
- Original list after it has been created from the server stream- Returns:
original
unmodified.
-
-