edu.udo.cs.yale.tools
Class TempFileService

java.lang.Object
  extended by edu.udo.cs.yale.tools.TempFileService

public class TempFileService
extends java.lang.Object

This class manages temporary files like model files, files with predicted labels, and so on. The methods of this class can handle given strings that shall be part of the name of the temporary files and automatically increments a counter that is also part of these file names. Methods for using base files or renaming are also included. The user can choose, whether all temporary files are to be kept or to be deleted as soon as they are no longer needed or as soon as the YALE has completed the whole experiment.

Version:
$Id: TempFileService.java,v 2.20 2006/08/03 14:39:31 ingomierswa Exp $
Author:
Ingo Mierswa

Field Summary
static java.lang.String[] DELETE_TEMP_FILES
           
private static int deleteTempFiles
          Indicates wether or not deleteOnExit() should be invoked on all created temporary files.
static int DIRECTLY
           
static int NO
           
static int ON_EXIT
           
private static java.lang.String TMP_PREFIX
          Prefix of all files.
private static java.io.File tmpDir
          Directory of all temp files.
 
Constructor Summary
TempFileService()
           
 
Method Summary
static java.io.File createTempFile()
          Creates a new temp file with a name build of prefix and the current file index.
static java.io.File createTempFile(java.io.File oldfile)
          Gets a file and renames it to prefix + current file index.
static java.io.File createTempFile(java.lang.String name)
          Like createTempFile, additionally the given name is part of the file name.
static java.io.File createTempFile(java.lang.String name, java.io.File oldfile)
          Like createTempFile(File), additionally the given name is part of the file name.
static java.io.File createTempFile(java.lang.String name, java.lang.String extension)
          Like createTempFile, additionally the given name is part of the file name.
static java.lang.String createTempFiles(java.lang.String name, java.lang.String[] extensions, java.io.File[] files)
          Fills the given file array with files of a created filestem (which will be returned), and each of the extensions.
static void deleteTempDir()
           
static void deleteTempFile(java.io.File file)
          Deletes the file if delete_temp_files is set to DIRECTLY.
static java.io.File getTempDir()
          Returns the temp dir.
static void init(Experiment experiment)
          Initializes the temp file service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELETE_TEMP_FILES

public static final java.lang.String[] DELETE_TEMP_FILES

NO

public static final int NO
See Also:
Constant Field Values

DIRECTLY

public static final int DIRECTLY
See Also:
Constant Field Values

ON_EXIT

public static final int ON_EXIT
See Also:
Constant Field Values

deleteTempFiles

private static int deleteTempFiles
Indicates wether or not deleteOnExit() should be invoked on all created temporary files. One out of NO, DIRECTLY, and ON_EXIT.


TMP_PREFIX

private static final java.lang.String TMP_PREFIX
Prefix of all files. The value is "_yale_".

See Also:
Constant Field Values


tmpDir

private static java.io.File tmpDir
Directory of all temp files.

Constructor Detail

TempFileService

public TempFileService()
Method Detail

init

public static void init(Experiment experiment)
                 throws OperatorException
Initializes the temp file service.

Throws:
OperatorException


createTempFile

public static java.io.File createTempFile()
Creates a new temp file with a name build of prefix and the current file index.


createTempFile

public static java.io.File createTempFile(java.lang.String name)
Like createTempFile, additionally the given name is part of the file name.


createTempFile

public static java.io.File createTempFile(java.lang.String name,
                                          java.lang.String extension)
Like createTempFile, additionally the given name is part of the file name.


createTempFile

public static java.io.File createTempFile(java.io.File oldfile)
Gets a file and renames it to prefix + current file index.


createTempFile

public static java.io.File createTempFile(java.lang.String name,
                                          java.io.File oldfile)
Like createTempFile(File), additionally the given name is part of the file name.


createTempFiles

public static java.lang.String createTempFiles(java.lang.String name,
                                               java.lang.String[] extensions,
                                               java.io.File[] files)
Fills the given file array with files of a created filestem (which will be returned), and each of the extensions.


deleteTempFile

public static void deleteTempFile(java.io.File file)
Deletes the file if delete_temp_files is set to DIRECTLY.


getTempDir

public static java.io.File getTempDir()
Returns the temp dir.


deleteTempDir

public static void deleteTempDir()


Copyright © 2001-2006