edtFTPj/Free - Open-source FTP library for Java | Download


com.enterprisedt.net.ftp
Class FTPFileParser

java.lang.Object
  extended by com.enterprisedt.net.ftp.FTPFileParser
Direct Known Subclasses:
MLSXEntryParser, MVSFileParser, NetwareFileParser, OS400FileParser, UnixFileParser, VMSFileParser, WindowsFileParser

public abstract class FTPFileParser
extends java.lang.Object

Root class of all file parsers

Version:
$Revision: 1.10 $
Author:
Bruce Blackshaw

Field Summary
protected  boolean ignoreDateParseErrors
          Ignore date parsing errors
 
Constructor Summary
FTPFileParser()
           
 
Method Summary
 boolean isMultiLine()
          Does this parser parse multiple lines to get one listing?
 boolean isValidFormat(java.lang.String[] listing)
          Valid format for this parser
abstract  FTPFile parse(java.lang.String raw)
          Parse server supplied string
 void setIgnoreDateParseErrors(boolean ignore)
          Ignore date parse errors
abstract  void setLocale(java.util.Locale locale)
          Set the locale for date parsing of listings
protected  java.lang.String[] split(java.lang.String str)
          Splits string consisting of fields separated by whitespace into an array of strings.
protected  java.lang.String[] split(java.lang.String str, char token)
          Splits string consisting of fields separated by whitespace into an array of strings.
protected  java.lang.String[] split(java.lang.String str, com.enterprisedt.net.ftp.FTPFileParser.Splitter splitter)
          Splits string consisting of fields separated by whitespace into an array of strings.
protected  java.lang.String trimStart(java.lang.String str)
          Trim the start of the supplied string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ignoreDateParseErrors

protected boolean ignoreDateParseErrors
Ignore date parsing errors

Constructor Detail

FTPFileParser

public FTPFileParser()
Method Detail

parse

public abstract FTPFile parse(java.lang.String raw)
                       throws java.text.ParseException
Parse server supplied string

Parameters:
raw - raw string to parse
Throws:
java.text.ParseException

setLocale

public abstract void setLocale(java.util.Locale locale)
Set the locale for date parsing of listings

Parameters:
locale - locale to set

setIgnoreDateParseErrors

public void setIgnoreDateParseErrors(boolean ignore)
Ignore date parse errors

Parameters:
ignore -

isValidFormat

public boolean isValidFormat(java.lang.String[] listing)
Valid format for this parser

Parameters:
listing - listing to test
Returns:
true if valid

isMultiLine

public boolean isMultiLine()
Does this parser parse multiple lines to get one listing?

Returns:

trimStart

protected java.lang.String trimStart(java.lang.String str)
Trim the start of the supplied string

Parameters:
str - string to trim
Returns:
string trimmed of whitespace at the start

split

protected java.lang.String[] split(java.lang.String str)
Splits string consisting of fields separated by whitespace into an array of strings. Yes, we could use String.split() but this would restrict us to 1.4+

Parameters:
str - string to split
Returns:
array of fields

split

protected java.lang.String[] split(java.lang.String str,
                                   char token)
Splits string consisting of fields separated by whitespace into an array of strings. Yes, we could use String.split() but this would restrict us to 1.4+

Parameters:
str - string to split
Returns:
array of fields

split

protected java.lang.String[] split(java.lang.String str,
                                   com.enterprisedt.net.ftp.FTPFileParser.Splitter splitter)
Splits string consisting of fields separated by whitespace into an array of strings. Yes, we could use String.split() but this would restrict us to 1.4+

Parameters:
str - string to split
Returns:
array of fields


Copyright (c) 2001-2007 Enterprise Distributed Technologies Ltd. All Rights Reserved.