• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOImage: Load Any image with certain prefix...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOImage: Load Any image with certain prefix...


  • Subject: Re: WOImage: Load Any image with certain prefix...
  • From: Nathan Walker <email@hidden>
  • Date: Thu, 30 Jun 2005 15:19:27 -0400

This worked perfectly....wow, you guys really rock...

I really strive to be this good. Thanks a million!

Efficiency question:  If I call this 5-6 times throughout every page in my application, would that create a performance hit having to loop through the loop so many times and having to hit "listFiles()" each time.  Does that even matter ? or should be concerned with ?
Would it be best to create a variable once in the Application class for   File[] fileList = aDirectory.listFiles();  so that only needs to be called once and reference that variable in the utility method ?

Things such as this, I'm not to fresh on.


On Jun 30, 2005, at 2:49 PM, Robert Walker wrote:

public static String fileNameStartingWith(File aDirectory, String pattern) throws RuntimeException {
        if (!aDirectory.isDirectory()) {
            throw new RuntimeException("Invalid directory!");
        }

        

        File[] fileList = aDirectory.listFiles();
        File aFile = null;
        for (int i = 0; i < fileList.length; i++) {
            aFile = fileList[i];
            if (aFile.getName().startsWith(pattern)) {
                return aFile.getName();
            }
        }
        return null;
    }

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: WOImage: Load Any image with certain prefix...
      • From: Sacha Mallais <email@hidden>
    • Re: WOImage: Load Any image with certain prefix...
      • From: Chuck Hill <email@hidden>
References: 
 >WOImage: Load Any image with certain prefix... (From: Nathan Walker <email@hidden>)
 >Re: WOImage: Load Any image with certain prefix... (From: Sacha Mallais <email@hidden>)
 >Re: WOImage: Load Any image with certain prefix... (From: Nathan Walker <email@hidden>)
 >Re: WOImage: Load Any image with certain prefix... (From: Sacha Mallais <email@hidden>)
 >Re: WOImage: Load Any image with certain prefix... (From: Nathan Walker <email@hidden>)
 >Re: WOImage: Load Any image with certain prefix... (From: Robert Walker <email@hidden>)

  • Prev by Date: Re: WOImage: Load Any image with certain prefix...
  • Next by Date: Re: WOImage: Load Any image with certain prefix...
  • Previous by thread: Re: WOImage: Load Any image with certain prefix...
  • Next by thread: Re: WOImage: Load Any image with certain prefix...
  • Index(es):
    • Date
    • Thread