Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.ode.utils.fs
Class TempFileManager

    java.lang.Object
      org.apache.ode.utils.fs.TempFileManager

    public class TempFileManager

extends java.lang.Object

Convenience class for managing temporary files and cleanup on JVM exit.

Method Summary
`static void` | `cleanup()` Clear out the temporary working directory.
`static java.io.File` | `getTemporaryDirectory(java.lang.String handle)` Get a temporary working directory.
`static java.io.File` | `getTemporaryDirectory(java.lang.String handle, java.io.File parent)`
`static java.io.File` | `getTemporaryFile(java.lang.String handle)` Get a temporary file, if possible, and register it for cleanup later.
`static java.io.File` | `getTemporaryFile(java.lang.String handle, java.io.File parent)`
`static void` | `registerTemporaryFile(java.io.File f)`
`static void` | `setWorkingDirectory(java.io.File f)` Set the working temporary directory.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### setWorkingDirectory

    public static void setWorkingDirectory(java.io.File f)

  Set the working temporary directory. This method can only be invoked when the singleton instance is uninitialized, and the `File` passed in must be both a directory and writable.

  Parameters:
    `f` - the temporary working directory

### getTemporaryFile

    public static java.io.File getTemporaryFile(java.lang.String handle)

  Get a temporary file, if possible, and register it for cleanup later. In the event that a temporary file cannot be created, the method will attempt to create a file in the current working directory instead.

  Parameters:
    `handle` - a prefix to use in naming the file; probably only useful for debugging.
  Returns:
    the temporary file.

### getTemporaryFile

    public static java.io.File getTemporaryFile(java.lang.String handle,
                                                java.io.File parent)

### getTemporaryDirectory

    public static java.io.File getTemporaryDirectory(java.lang.String handle)

  Get a temporary working directory.

  Parameters:
    `handle` - a prefix to use in naming the directory.
  Returns:
    the temp directory.
  See Also:
    `getTemporaryFile(String)`

### getTemporaryDirectory

    public static java.io.File getTemporaryDirectory(java.lang.String handle,
                                                     java.io.File parent)

### registerTemporaryFile

    public static void registerTemporaryFile(java.io.File f)

### cleanup

    public static void cleanup()

  Clear out the temporary working directory. This can be called by, e.g., a commandline tool or other client when it is known that all temporary files can be deleted.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD