com.myjavaworld.ftp
Interface ListParser

All Known Implementing Classes:
DefaultListParser, DosListParser

public interface ListParser

A contract for classes that are used to parse the directory listing produced by an FTP server. Since different FTP servers produce the listing in different formats, this interface helps switch between List parsers.

Version:
2.0
Author:
Sai Pullabhotla, psai [at] jMethods [dot] com

Method Summary
 RemoteFile createRemoteFile(RemoteFile parent, String name)
          Creates a RemoteFile object
 RemoteFile createRemoteFile(RemoteFile parent, String name, boolean dir)
          Creates a RemoteFile object.
 RemoteFile createRemoteFile(String path)
          Creates a RemoteFile object.
 RemoteFile createRemoteFile(String path, boolean dir)
          Creates a RemoteFile object.
 RemoteFile createRemoteFile(String parent, String name)
          Creates a RemoteFile object.
 RemoteFile createRemoteFile(String parent, String name, boolean dir)
          Creates a RemoteFile object.
 String getDescription()
          Returns the description of this parser.
 String getName()
          Gets the name of this ListParser
 String getVendor()
          Gets the vendor name of this parser.
 String getVersion()
          Gets the version of this parser.
 RemoteFile[] parse(RemoteFile parent, BufferedReader reader)
          Parses the directory listing returned by an FTP server into an array of RemoteFile objects.
 RemoteFile parse(RemoteFile parent, String rawData)
          Parses a line of output in to a RemoteFile object.
 

Method Detail

parse

RemoteFile[] parse(RemoteFile parent,
                   BufferedReader reader)
                   throws ParseException,
                          IOException
Parses the directory listing returned by an FTP server into an array of RemoteFile objects.

Parameters:
parent - the directory whose contents are listed
reader - the reader containing the data returned by the server
Returns:
the equivalent RemoteFile objects
Throws:
ParseException - if any error occurs while parsing the directory listing.
IOException - propagated

parse

RemoteFile parse(RemoteFile parent,
                 String rawData)
                 throws ParseException
Parses a line of output in to a RemoteFile object.

Parameters:
parent - Parent directory.
rawData - a line of output from the LIST command.
Returns:
RemoteFile object.
Throws:
ParseException - if the rawData can not be parsed by this ListParser.

createRemoteFile

RemoteFile createRemoteFile(String path)
Creates a RemoteFile object. The created object will be marked as a directory.

Parameters:
path - Absolute path name
Returns:
RemoteFile object.

createRemoteFile

RemoteFile createRemoteFile(String path,
                            boolean dir)
Creates a RemoteFile object.

Parameters:
path - Absolute path name
dir - If this is true, the created object will be marked as a directory. Otherwise, a file.
Returns:
RemoteFile object.

createRemoteFile

RemoteFile createRemoteFile(String parent,
                            String name)
Creates a RemoteFile object.

Parameters:
parent - Parent file
name - Name of the file The created object will be marked as a directory.
Returns:
RemoteFile object.

createRemoteFile

RemoteFile createRemoteFile(String parent,
                            String name,
                            boolean dir)
Creates a RemoteFile object.

Parameters:
parent - Parent file
name - Name of the file
dir - If this is true, the created object will be marked as a directory. Otherwise, a file.
Returns:
RemoteFile object.

createRemoteFile

RemoteFile createRemoteFile(RemoteFile parent,
                            String name)
Creates a RemoteFile object

Parameters:
parent - Parent file
name - Name of the file
Returns:
RemoteFile object.

createRemoteFile

RemoteFile createRemoteFile(RemoteFile parent,
                            String name,
                            boolean dir)
Creates a RemoteFile object.

Parameters:
parent - Parent file
name - Name of the file
dir - , if this is true, the created object will be marked as a directory. Otherwise a file.
Returns:
RemoteFile object.

getName

String getName()
Gets the name of this ListParser

Returns:
Name of this parser.

getDescription

String getDescription()
Returns the description of this parser.

Returns:
Description

getVendor

String getVendor()
Gets the vendor name of this parser.

Returns:
Vendor name.

getVersion

String getVersion()
Gets the version of this parser.

Returns:
Version number of this parser.


Copyright © 2000-2012 jMethods, Inc.. All Rights Reserved.