com.myjavaworld.ftp
Class DosListParser

java.lang.Object
  extended by com.myjavaworld.ftp.DosListParser
All Implemented Interfaces:
ListParser

public class DosListParser
extends Object
implements ListParser

An implementation of ListParser interface used to parse the directory listing of FTP servers, which produce the output in MS-DOS format.

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

Constructor Summary
DosListParser()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DosListParser

public DosListParser()
Method Detail

parse

public RemoteFile[] parse(RemoteFile parent,
                          BufferedReader reader)
                   throws ParseException,
                          IOException
Description copied from interface: ListParser
Parses the directory listing returned by an FTP server into an array of RemoteFile objects.

Specified by:
parse in interface ListParser
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

public RemoteFile parse(RemoteFile parent,
                        String rawData)
                 throws ParseException
Description copied from interface: ListParser
Parses a line of output in to a RemoteFile object.

Specified by:
parse in interface ListParser
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

public RemoteFile createRemoteFile(String path)
Description copied from interface: ListParser
Creates a RemoteFile object. The created object will be marked as a directory.

Specified by:
createRemoteFile in interface ListParser
Parameters:
path - Absolute path name
Returns:
RemoteFile object.

createRemoteFile

public RemoteFile createRemoteFile(String path,
                                   boolean dir)
Description copied from interface: ListParser
Creates a RemoteFile object.

Specified by:
createRemoteFile in interface ListParser
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

public RemoteFile createRemoteFile(String parent,
                                   String name)
Description copied from interface: ListParser
Creates a RemoteFile object.

Specified by:
createRemoteFile in interface ListParser
Parameters:
parent - Parent file
name - Name of the file The created object will be marked as a directory.
Returns:
RemoteFile object.

createRemoteFile

public RemoteFile createRemoteFile(String parent,
                                   String name,
                                   boolean dir)
Description copied from interface: ListParser
Creates a RemoteFile object.

Specified by:
createRemoteFile in interface ListParser
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

public RemoteFile createRemoteFile(RemoteFile parent,
                                   String name)
Description copied from interface: ListParser
Creates a RemoteFile object

Specified by:
createRemoteFile in interface ListParser
Parameters:
parent - Parent file
name - Name of the file
Returns:
RemoteFile object.

createRemoteFile

public RemoteFile createRemoteFile(RemoteFile parent,
                                   String name,
                                   boolean dir)
Description copied from interface: ListParser
Creates a RemoteFile object.

Specified by:
createRemoteFile in interface ListParser
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

public String getName()
Description copied from interface: ListParser
Gets the name of this ListParser

Specified by:
getName in interface ListParser
Returns:
Name of this parser.

getDescription

public String getDescription()
Description copied from interface: ListParser
Returns the description of this parser.

Specified by:
getDescription in interface ListParser
Returns:
Description

getVendor

public String getVendor()
Description copied from interface: ListParser
Gets the vendor name of this parser.

Specified by:
getVendor in interface ListParser
Returns:
Vendor name.

getVersion

public String getVersion()
Description copied from interface: ListParser
Gets the version of this parser.

Specified by:
getVersion in interface ListParser
Returns:
Version number of this parser.


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