Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Signed Applet - Problem reading large local files



Alan McMorran <email@hidden> wrote:

>I had originally made it do:
>
>String ret = new String();
>
>For (int I=0; I<objects.length; I++){
>    ret += objects[I].outputXML() + "\n";
>}
>
>Return ret;
>
>Then put the string into a file, but the time taken increased exponentially
>as the number of objects increased.

That's because the code is actually creating a new StringBuffer or two each
time around the loop, using it temporarily, then leaving it for GC.  This
is one of the worst possible ways to build up a String.  Use
StringBuffer.append() instead, on a single StringBuffer.


>P.S. Just noticed Entourage insists on capitalising various commands in the
>above code, but you get the general idea.

There's probably a setting to turn it off.  If not, file a bug-report with MS.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.