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

## org.apache.poi.util
Class TempFile

    java.lang.Object
      org.apache.poi.util.TempFile

    public final class TempFile

extends java.lang.Object

Interface for creating temporary files. Collects them all into one directory by default.

Nested Class Summary
`static class` | `TempFile.DefaultTempFileCreationStrategy` Deprecated. POI 3.15 beta 3. Moved to `DefaultTempFileCreationStrategy`.

Field Summary
`static java.lang.String` | `JAVA_IO_TMPDIR` Define a constant for this property as it is sometimes mistypes as "tempdir" otherwise

Method Summary
`static java.io.File` | `createTempDirectory(java.lang.String name)`
`static java.io.File` | `createTempFile(java.lang.String prefix, java.lang.String suffix)` Creates a new and empty temporary file.
`static void` | `setTempFileCreationStrategy(TempFileCreationStrategy strategy)` Configures the strategy used by `createTempFile(String, String)` to create the temporary files.

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

Field Detail

### JAVA_IO_TMPDIR

    public static final java.lang.String JAVA_IO_TMPDIR

  Define a constant for this property as it is sometimes mistypes as "tempdir" otherwise

  See Also:
    Constant Field Values

Method Detail

### setTempFileCreationStrategy

    public static void setTempFileCreationStrategy(TempFileCreationStrategy strategy)

  Configures the strategy used by `createTempFile(String, String)` to create the temporary files.

  Parameters:
    `strategy` - The new strategy to be used to create the temporary files.
  Throws:
    `java.lang.IllegalArgumentException` - When the given strategy is `null`.

### createTempFile

    public static java.io.File createTempFile(java.lang.String prefix,
                                              java.lang.String suffix)
                                       throws java.io.IOException

  Creates a new and empty temporary file. By default, files are collected into one directory and are deleted on exit from the VM, although they can be kept by defining the system property `poi.keep.tmp.files` (see `TempFile.DefaultTempFileCreationStrategy`).

  Don't forget to close all files or it might not be possible to delete them.

  Parameters:
    `prefix` - The prefix to be used to generate the name of the temporary file.
    `suffix` - The suffix to be used to generate the name of the temporary file.
  Returns:
    The path to the newly created and empty temporary file.
  Throws:
    `java.io.IOException` - If no temporary file could be created.

### createTempDirectory

    public static java.io.File createTempDirectory(java.lang.String name)
                                            throws java.io.IOException

  Throws:
    `java.io.IOException`

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

Copyright 2017 The Apache Software Foundation or its licensors, as applicable.