Class FTPFileParser

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

public abstract class FTPFileParser extends Object
Root class of all file parsers
Version:
$Revision$
Author:
Bruce Blackshaw
  • Field Details

    • ignoreDateParseErrors

      protected boolean ignoreDateParseErrors
      Ignore date parsing errors
  • Constructor Details

    • FTPFileParser

      public FTPFileParser()
  • Method Details

    • parse

      public abstract FTPFile parse(String raw) throws ParseException
      Parse server supplied string
      Parameters:
      raw - raw string to parse
      Throws:
      ParseException
    • setLocale

      public abstract void setLocale(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(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 String trimStart(String str)
      Trim the start of the supplied string
      Parameters:
      str - string to trim
      Returns:
      string trimmed of whitespace at the start
    • split

      protected String[] split(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 String[] split(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 String[] split(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