commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Jeffrey D. Brekke)
Subject Re: [NET] ftp entry spans lines
Date Sun, 02 Mar 2003 01:11:35 GMT
"Steve Cohen" <> writes:

> If you are going to include the entry ending in the same regular
> expression that you use to break the entries down you either have to
> 1) parse the whole thing as you are breaking apart the entries,
> essentially doing away with the idea of not creating the FTPFile
> entries right away 
> OR 
> 2) parse it twice, on the first pass not attempting to break it down
> further than the entry delimiter, and then parsing it fully on the
> second pass.
> Since the regular expression is undoubtedly much more complicated
> than the first pass requires, the problem with 2) is that it might
> be very inefficient.
> I see two alternatives here: 
> 3) Make each parser have TWO regular expressions, a simpler one for
> delimiting entries and the current one for breaking them down into
> FTP Files.
> 4) Use a non-regular expression method for delimiting entries
> probably on the level, similar to what readLine() does.
> However neither of these would work in the VMS case you describe if
> there is no delimiter that can be looked ahead for, that is, if the
> delimiting is done solely by context using the "algorithm" that "the
> next entry starts when the last entry is finished".  Is that the
> case or is there some sort of delimiter?

Yea this is more like what we saw.  The entries that spanned two lines
were done just for presenting the list nicely ( not sure if this is
exact, but should do for an example.  I'll get an excat sample on
Monday at work ):

1-JUN.LIS;1              9/9           2-jun-1998 07:32:04  [GROUP,OWNER]    (RWED,RWED,RWED,RE)

1-JUN.LIS;2              9/9           JUN-2-1998 07:32:04  [GROUP,OWNER]    (RWED,RWED,RWED,)

1-JUN.LIS;2              a/9           2-JUN-98 07:32:04    [GROUP,OWNER]    (RWED,RWED,RWED,)

                         1/9           2-JUN-1998 07:32:04  [GROUP,OWNER]    (,RWED,RWED,RE)

So the line terminators don't mean much, but the RE matching can
determine the number of entries correctly.  Maybe something like #3
above would work to iterate through the entries somehow with the RE.
Not sure its been a few months since I've thought much about this
> The readLine() method of delimiting entries was something I copied
> from the DefaultFileListParser.  My mistake was in assuming that
> that approach could be generalized everywhere.

The old parsers work since the entire list is parsed up front.  Our
parser uses the RE to determine the entries.  That is what we are
using in production now.

Jeffrey D. Brekke                         
Wisconsin,  USA                           

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message