public class TempFileHandler
extends java.lang.Object
implements java.io.Closeable
| Constructor and Description |
|---|
TempFileHandler() |
TempFileHandler(java.io.File tempFileDirectory) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp()
Removes all temporary files and close all readers/writers.
|
void |
close() |
java.lang.String |
createTempFile()
Create a new temporary file in the given directory.
|
void |
deleteTempFile(java.lang.String uuid)
Delete a temporary file by UUID and if created the corresponding
reader/writer.
|
java.io.BufferedReader |
getFileReaderForTempFile(java.lang.String uuid)
Create or retrieve an existing file reader for a temporary file by UUID.
|
java.io.FileWriter |
getFileWriterForTempFile(java.lang.String uuid)
Create or retrieve an existing file writer for a temporary file by UUID.
|
java.io.File |
getTempFile(java.lang.String uuid)
Get the temporary file with the UUID.
|
java.lang.String |
getTempFileDirPath() |
public TempFileHandler(java.io.File tempFileDirectory)
public TempFileHandler()
public java.lang.String createTempFile()
public java.io.File getTempFile(java.lang.String uuid)
uuid - UUID of the file.public java.io.BufferedReader getFileReaderForTempFile(java.lang.String uuid)
uuid - UUID of the temporary file.public java.io.FileWriter getFileWriterForTempFile(java.lang.String uuid)
uuid - UUID of the temporary file.public void deleteTempFile(java.lang.String uuid)
uuid - UUID of the file.public void cleanUp()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic java.lang.String getTempFileDirPath()