org.ourgrid.common.util
Class TempFileManager

java.lang.Object
  extended by org.ourgrid.common.util.TempFileManager

public class TempFileManager
extends java.lang.Object

Description: An utility class created to lead with temp files.

Version:
1.0 Created on 27/07/2004

Constructor Summary
TempFileManager()
           
 
Method Summary
static java.io.File createTempFile()
          Creates a temp file with the format mygrid???.tmp in the default temp dir.
static java.io.File createTempFile(java.lang.String prefix, java.lang.String sufix)
          Creates a temp file with the format prefix???sufix in the default temp dir.
static java.io.File createTempFile(java.lang.String prefix, java.lang.String sufix, java.io.File dir)
          Creates a temp file with the format prefix???sufix in a specified dir.
static java.io.File createTempFileWithBogusData(java.lang.String prefix, java.lang.String sufix, java.io.File dir, int nbytes)
          Creates a temp file with the format prefix???sufix in a specified dir with a specified amount of bogus data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TempFileManager

public TempFileManager()
Method Detail

createTempFile

public static java.io.File createTempFile()
                                   throws java.io.IOException
Creates a temp file with the format mygrid???.tmp in the default temp dir. (??? is a random long number.)

Returns:
The temp file handler.
Throws:
java.io.IOException - If the temp file could not be created.

createTempFile

public static java.io.File createTempFile(java.lang.String prefix,
                                          java.lang.String sufix)
                                   throws java.io.IOException
Creates a temp file with the format prefix???sufix in the default temp dir. (??? is a random long number.)

Parameters:
prefix - A prefix for the temp file.
sufix - A sufix for the temp file.
Returns:
The temp file handler.
Throws:
java.io.IOException - If the temp file could no be created.

createTempFile

public static java.io.File createTempFile(java.lang.String prefix,
                                          java.lang.String sufix,
                                          java.io.File dir)
                                   throws java.io.IOException
Creates a temp file with the format prefix???sufix in a specified dir. (??? is a random long number.)

Parameters:
prefix - A prefix for the temp file.
sufix - A sufix for the temp file.
dir - The temp file directory
Returns:
The temp file handler.
Throws:
java.io.IOException - If the temp file could no be created.

createTempFileWithBogusData

public static java.io.File createTempFileWithBogusData(java.lang.String prefix,
                                                       java.lang.String sufix,
                                                       java.io.File dir,
                                                       int nbytes)
                                                throws java.io.IOException
Creates a temp file with the format prefix???sufix in a specified dir with a specified amount of bogus data. (??? is a random long number.)

Parameters:
prefix - A prefix for the temp file.
sufix - A sufix for the temp file.
dir - The temp file directory
nbytes - The amount of bogus data to be wrote on the temp file (in bytes).
Returns:
The temp file handler.
Throws:
java.io.IOException - If the temp file could no be created.