Thanks Henry!
When you create a valid file handle, it actually does create a file which is
ready to be associted with the "OutputStream" and hence content can be
written.
For example:
//Creating File handle
File tempFile = File.createTempFile("test", ".txt"); //Here the actual file
is created in the file system
//Create DeferredFileOutputStream
DeferredFileOutputStream fos = new DeferredFileOutputStream(2048, tempFile);
//For example I write a byte[] lower than 2048 then content will stay in
memory ( for sake of the example
byte[] tempBytes = new String("TEST").getBytes();
fos.write(tempByte);
fos.flush();
fos.close()
//Now .. let us check if data is in memory
if (fos.isInMemory()) System.out.println("In memory");
//Now since file was created even though not used.. I still have to delete
this
tempFile.delete();
The second part of my question is "I would rather have file creation and
deletion does inside this class" by a method call. It should allow the
consumer to set (by method call) "location" where temp files to be created.
Hope this clearifies my question. Again, this is not a big issue but in
production systems temp file creation and deletion are crucial.
Thanks so much for your time!
-----Original Message-----
From: Henri Yandell [mailto:[EMAIL PROTECTED]
Sent: Friday, March 12, 2004 10:13 AM
To: Jakarta Commons Users List
Subject: Re: Common-io - DeferredOutputStream
new File(..) doesn't create an actual File, so I'm not sure why that's
such a bad thing?
I'm not really sure what the second half of your email means though. Can
you elaborate?
Hen
On Fri, 12 Mar 2004 [EMAIL PROTECTED] wrote:
> This is a great class. However, it requires a File handle ( means I have
to
> create a File before I used this) in the constructor which defeats the
> purpose. Can the file creation ( based threshold ) and deletion is done
> internally.
>
> Regards,
>
> Surendra
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]