coins.driver
Class TemporaryFileManager

java.lang.Object
  extended bycoins.driver.TemporaryFileManager

public class TemporaryFileManager
extends java.lang.Object

Provides temporary file management facility.
A temporary file with any presix and suffix can be created.
More than one manager can work together at same time.


Constructor Summary
TemporaryFileManager()
          Constructs a new manager.
 
Method Summary
 void cleanupTemporaryFiles()
          Deletes all temporary files created by this manager.
 java.io.File createTemporaryFile()
          Creates a temporary file and returns its path name.
 java.io.File createTemporaryFile(java.lang.String suffix)
          Creates a temporary file with a specified suffix and returns its path name.
 java.io.File createTemporaryFile(java.lang.String prefix, java.lang.String suffix)
          Creates a temporary file with a specified prefix and suffix and returns its path name.
 java.util.Collection getTemporaryFiles()
          Returns a list of temporary files ever created by this manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemporaryFileManager

public TemporaryFileManager()
Constructs a new manager.

Method Detail

cleanupTemporaryFiles

public void cleanupTemporaryFiles()
Deletes all temporary files created by this manager.


createTemporaryFile

public java.io.File createTemporaryFile()
                                 throws java.io.IOException
Creates a temporary file and returns its path name.

Returns:
a temporary file path name.
Throws:
java.io.IOException - - failed to create a file.

createTemporaryFile

public java.io.File createTemporaryFile(java.lang.String suffix)
                                 throws java.io.IOException
Creates a temporary file with a specified suffix and returns its path name.

Parameters:
suffix - a suffix.
Returns:
a temporary file path name.
Throws:
java.io.IOException - - failed to create a file.

createTemporaryFile

public java.io.File createTemporaryFile(java.lang.String prefix,
                                        java.lang.String suffix)
                                 throws java.lang.IllegalArgumentException,
                                        java.io.IOException
Creates a temporary file with a specified prefix and suffix and returns its path name. The prefix length must be three or more.

Parameters:
prefix - a prefix.
suffix - a suffix.
Returns:
a temporary file path name.
Throws:
java.lang.IllegalArgumentException - - prefix length is short.
java.io.IOException - - failed to create a file.

getTemporaryFiles

public java.util.Collection getTemporaryFiles()
Returns a list of temporary files ever created by this manager. The list is a Collection of Files.

Returns:
a temporary file path name list.