commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Common-io - DeferredOutputStream
Date Fri, 12 Mar 2004 16:22:00 GMT
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

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();

//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

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 []
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?


On Fri, 12 Mar 2004 wrote:

> This is a great class. However, it requires a File handle ( means I have
> 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:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message