Article View: borland.public.jbuilder.java.api
Article #2164Re: File.renameTo() doesn't update object
From: Owen Green
Date: Tue, 08 May 2001 13:15
Date: Tue, 08 May 2001 13:15
20 lines
1727 bytes
1727 bytes
> a File instances represents merely a file's name, not the file
> itself. While I agree that it's not that intuitive it's somewhat
> consistent to how the File class works.
Torsten,
Thanks for the reply. I suppose I'd always sort of imagined it as
representing a FAT entry, or equivalent, and had assumed that the name was
just a mutable property. Thanks for clearing that up.
It is a trifle annoying, as I was only trying to do some simple file locking
by changing the file extension once a worker thread has picked it up - to
keep the reference valid, I've ended up with some very ugly code like:
myFile.renameTo((myFile = new File(newFileName)).
Which screams 'memory leak' to my delphi-trained, non-GC soul, but I
supposse if the ref to the original file has been lost, it'll just be GC'd
at some point...
Thanks again
Owen
Technical Details
Message-ID:
<3af7f187_2@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!feed2.onemain.com!feed1.onemain.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3af1409d$1_2@dnews> <3af63baa$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,a7b3eb68e6cc2342 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2001-05-08 06:26:02 PST From: "Owen Green" <owen@norobots.unique.com> Newsgroups: borland.public.jbuilder.java.api References: <3af1409d$1_2@dnews> <3af63baa$1_1@dnews> Subject: Re: File.renameTo() doesn't update object Date: Tue, 8 May 2001 14:15:45 +0100 Lines: 24 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 213.86.7.136 Message-ID: <3af7f187_2@dnews> X-Trace: dnews 989327751 213.86.7.136 (8 May 2001 06:15:51 -0700) Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!feed2.onemain.com!feed1.onemain.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews