Article View: borland.public.jbuilder.java.language
Article #8266Re: Unique file name
From: Michael Rachow
Date: Tue, 03 Apr 2001 13:48
Date: Tue, 03 Apr 2001 13:48
59 lines
2883 bytes
2883 bytes
Hi se
I think Joi's advice is the right one.
All that checking and saveness is done by that class.
Of cource you have to use thre same directory for
all users.
File outFile = File.createTempFile("BegOfFileName", ".extension", new
File("YourNetPath"));
Between BegOfFileName" and ".extension" there will be inserted something
that makes the file unique.
"se wen" <se_wen@nightmail> schrieb im Newsbeitrag
news:3ac3b766$1_1@dnews...
> Hi Joi Ellis,
> Thanks for your response. I think I need to explain a little more in what
I
> am attempting to accomplish.
> My project currently creates a chart image and stores it in a directory
(see
> code) with a specified file name "chart.PNG".
>
> .................................................................
> JCEncodeComponent.encode(JCEncodeComponent.PNG, SESChart.snapshot(), new
> File("c:/Windows/jbproject/untitled8/src/untitled8/chart.PNG"));
> .................................................................
>
> However, since there will be multiple users and threads at the same time
> accessing the chart method we need some method that can scan the name of
the
> files in the directory (for the above example it would be 'untitled8')
then
> assign a new name that does not already exist in that directory. This name
> would need to be able to be stored as a variable so that it can be passed
to
> the above encoding method.
>
> Thanks again for your suggestions
>
> Stuart
>
>
> "Joi Ellis [TeamB]" <joi@aravox.com> wrote in message
> news:3ac3a833_1@dnews...
> > se wen <se_wen@nightmail> wrote:
> > > Hi,
> > > Does anyone know of any examples that can generate a unique file name,
> which
> > > can be stored as a variable to be passed to a method?
> >
> > java.io.File.createTempFile() ?
> >
> > --
> > Joi Ellis (TeamB)
> > No direct email, please.
> > For best results, post on news server newsgroups.borland.com!
> > Newsgroup Info: http://www.borland.com/newsgroups/guide.html
>
>
Technical Details
Message-ID:
<3ac9d7fe_2@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.uni2.dk!newssuck.uni2.dk!dnewsReferences:
<3ac3a412$1_1@dnews> <3ac3a833_1@dnews> <3ac3b766$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a9c867af487cce47 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-04-03 09:34:04 PST From: "Michael Rachow" <mrachow@BeraCom.de> Newsgroups: borland.public.jbuilder.java.language References: <3ac3a412$1_1@dnews> <3ac3a833_1@dnews> <3ac3b766$1_1@dnews> Subject: Re: Unique file name Date: Tue, 3 Apr 2001 15:48:31 +0200 Lines: 61 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: 62.226.214.108 Message-ID: <3ac9d7fe_2@dnews> X-Trace: dnews 986306558 62.226.214.108 (3 Apr 2001 07:02:38 -0700) Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews