Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #21783
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Jim Janney <jjanney@shell.xmission.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: The first 10 files |
| Date | Sat, 26 Jan 2013 20:47:26 -0700 |
| Organization | bilaterally symmetric |
| Lines | 49 |
| Message-ID | <ydn38xn1e41.fsf@shell.xmission.com> (permalink) |
| References | <mn.d04a7dd156c148ef.70216@a.com> <eWPMs.128009$tG.112190@newsfe15.iad> <51041ff8$0$284$14726298@news.sunsite.dk> <amivb3Fag8iU1@mid.individual.net> <ke1k0f$nqj$1@dont-email.me> <1iop8bl8ysrfg$.rdxcxhgxuj1r$.dlg@40tude.net> <ke20lo$sh1$1@dont-email.me> <c14x7pubxr70$.15kwu0dtzqycz$.dlg@40tude.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx04.eternal-september.org; posting-host="3c5d835c9a0219e1946f4dd3740c28b0"; logging-data="26391"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NjwsBE6aUwr6oInWZpsZo" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:0mkdaUg5nKl7YhOQclUYh3hSx2c= sha1:deLI/SjPO5Smx3K1uI+siFAjgBQ= |
| Xref | csiph.com comp.lang.java.programmer:21783 |
Show key headers only | View raw
Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> writes: > On Sat, 26 Jan 2013 20:42:16 -0500, Eric Sosman wrote: > >> [...] >>>> Because the listFiles() method will fetch the information >>>> for all 30K files from the O/S, will construct 30K File objects >>>> to represent them, and will submit all 30K File objects to the >>>> FileFilter, one by one. The FileFilter will (very quickly) >>>> reject 29.99K of the 30K Files, but ... >>> >>> Will it? >> >> Necessarily. As far as listFiles() knows, the FileFilter >> might accept the very last File object given to it. Therefore, >> listFiles() cannot fail to present that very last File -- and >> every other File -- for inspection. > > Except in the way I already noted, you mean. > >> [...] >>> Indeed, I suppose one could throw an exception from the FileFilter accept() >>> method to interrupt enumeration, if that's how listFiles() is implemented. >>> That would avoid the need to enumerate more than the needed number of >>> actual files. >> >> It would also avoid the burden of returning anything from >> listFiles() -- like, say, the array of accepted files ... > > As you've already agreed, it is possible for the FileFilter implementation > to store the results itself, obviating any need for the listFiles() method > to return successfully. > > If it works (which is not assured...it depends on how listFiles() is > implemented in the first place), then yes, maybe it's a bit of a kludge. > But it's an easier, more portable kludge than writing some JNI-based > component and would in fact get the job done. > > Sometimes, when the library you're using doesn't provide exactly the > features you need, you wind up with a kludge. Oh well...shit happens. > > I'm not saying it's a great solution. But it's a far cry from a conclusion > that it simply cannot be done with the Java API as it exists now. It's an abuse of the notion of a filter, but yes, it can be made to work. I stand corrected. -- Jim Janney
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
The first 10 files Wojtek <nowhere@a.com> - 2013-01-26 01:14 -0800
Re: The first 10 files Roedy Green <see_website@mindprod.com.invalid> - 2013-01-26 02:44 -0800
Re: The first 10 files Lew <lewbloch@gmail.com> - 2013-01-26 10:20 -0800
Re: The first 10 files "John B. Matthews" <nospam@nospam.invalid> - 2013-01-26 06:31 -0500
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-01-26 15:42 -0800
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 17:13 -0700
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:21 -0500
Re: The first 10 files "John B. Matthews" <nospam@nospam.invalid> - 2013-01-26 22:05 -0500
Re: The first 10 files Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-26 08:24 -0400
Re: The first 10 files Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-26 08:25 -0400
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 13:26 -0500
Re: The first 10 files Robert Klemme <shortcutter@googlemail.com> - 2013-01-26 22:15 +0100
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 16:25 -0500
Re: The first 10 files Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-26 17:06 -0500
Re: The first 10 files Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-26 15:21 -0800
Re: The first 10 files Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-26 20:42 -0500
Re: The first 10 files Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2013-01-26 17:56 -0800
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:29 -0500
Re: The first 10 files Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-26 21:56 -0500
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 20:51 -0700
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 20:47 -0700
Re: The first 10 files Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-26 22:02 -0400
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:35 -0500
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:43 -0500
Re: The first 10 files Robert Klemme <shortcutter@googlemail.com> - 2013-01-27 13:55 +0100
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-02-24 17:50 -0500
Re: The first 10 files Robert Klemme <shortcutter@googlemail.com> - 2013-02-25 21:53 +0100
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 20:57 -0700
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-01-26 21:20 -0800
Re: The first 10 files Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-27 07:23 -0400
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-27 20:36 -0500
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-01-28 16:28 -0800
Re: The first 10 files Arne Vajhøj <arne@vajhoej.dk> - 2013-01-26 21:23 -0500
Re: The first 10 files Roedy Green <see_website@mindprod.com.invalid> - 2013-01-26 19:09 -0800
Re: The first 10 files Jim Janney <jjanney@shell.xmission.com> - 2013-01-26 16:00 -0700
Re: The first 10 files Knute Johnson <nospam@knutejohnson.com> - 2013-01-26 18:37 -0800
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-03-14 03:07 -0700
Re: The first 10 files lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-03-14 12:49 +0000
Re: The first 10 files Robert Klemme <shortcutter@googlemail.com> - 2013-03-15 11:38 +0100
Re: The first 10 files Wojtek <nowhere@a.com> - 2013-03-15 10:31 -0700
csiph-web