org.apache.jackrabbit.util
Class TransientFileFactory

java.lang.Object
  extended byorg.apache.jackrabbit.util.TransientFileFactory

public class TransientFileFactory
extends Object

The TransientFileFactory utility class can be used to create transient files, i.e. temporary files that are automatically removed once the associated File object is reclaimed by the garbage collector.

File deletion is handled by a low-priority background thread.


Method Summary
 File createTransientFile(String prefix, String suffix, File directory)
          Same as File.createTempFile(String, String, File) except that the newly-created file will be automatically deleted once the returned File object has been gc'ed.
static TransientFileFactory getInstance()
          Returns the singleton TransientFileFactory instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TransientFileFactory getInstance()
Returns the singleton TransientFileFactory instance.


createTransientFile

public File createTransientFile(String prefix,
                                String suffix,
                                File directory)
                         throws IOException
Same as File.createTempFile(String, String, File) except that the newly-created file will be automatically deleted once the returned File object has been gc'ed.

Parameters:
prefix - The prefix string to be used in generating the file's name; must be at least three characters long
suffix - The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
directory - The directory in which the file is to be created, or null if the default temporary-file directory is to be used
Returns:
the newly-created empty file
Throws:
IOException - If a file could not be created


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.