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: Writing to a file



At 12:59 PM -0400 5/15/01, Jon Lucenius wrote:
Thought this would be simple now that I can use Java 1.3

Nothing is ever simple.

here's the code that I am using to create a file and write some stuff to
it. "docHeader" and the rest are defined elsewhere as Strings and I'll
remove the quotes - right now I'd be happy to write ANYTHING to the file.

You'll want to fw.close() or fw.flush() the file. Otherwise the output will be buffered until the object is finalized (most output stream objects close themselves on finalization -- since you obviously forgot). But since your application probably just terminates immediately, it's most likely that none of your objects are ever finalized, and thus your file is never closed.

You might also want to dump the exception or the stack trace in your catch clause, otherwise you really have no idea what happened.

__________________________________
James Bucanek
<mailto: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.