Package picard.nio
Class GATKIOUtils
java.lang.Object
picard.nio.GATKIOUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic File
createTempFile
(String name, String extension) Creates a temp file that will be deleted on exit This will also mark the corresponding Tribble/Tabix/BAM indices matching the temp file for deletion.static File
createTempFileInDirectory
(String name, String extension, File targetDir) Creates a temp file in a target directory that will be deleted on exit This will also mark the corresponding Tribble/Tabix/BAM indices matching the temp file for deletion.static void
deleteOnExit
(Path fileToDelete) Schedule a file or directory to be deleted on JVM shutdown.static void
deleteRecursively
(Path rootPath) Delete rootPath recursivelystatic Path
Converts the given URI to aPath
object.
-
Constructor Details
-
GATKIOUtils
public GATKIOUtils()
-
-
Method Details
-
deleteOnExit
Schedule a file or directory to be deleted on JVM shutdown. This callsdeleteRecursively(Path)
onfileToDelete
as a shutdown hook.- Parameters:
fileToDelete
- file or directory to be deleted recursively at JVM shutdown.
-
getPath
Converts the given URI to aPath
object. If the filesystem cannot be found in the usual way, then attempt to load the filesystem provider using the thread context classloader. This is needed when the filesystem provider is loaded using a URL classloader (e.g. in spark-submit). Also makes an attempt to interpret the argument as a file name if it's not a URI.- Parameters:
uriString
- the URI to convert.- Returns:
- the resulting
Path
- Throws:
UserException
- if an I/O error occurs when creating the file system
-
createTempFile
Creates a temp file that will be deleted on exit This will also mark the corresponding Tribble/Tabix/BAM indices matching the temp file for deletion.- Parameters:
name
- Prefix of the file;File.createTempFile(String, String, File)
requires that this be >= 3 charactersextension
- Extension to concat to the end of the file.- Returns:
- A file in the temporary directory starting with name, ending with extension, which will be deleted after the program exits.
-
createTempFileInDirectory
Creates a temp file in a target directory that will be deleted on exit This will also mark the corresponding Tribble/Tabix/BAM indices matching the temp file for deletion.- Parameters:
name
- Prefix of the file;File.createTempFile(String, String, File)
requires that this be >= 3 charactersextension
- Extension to concat to the end of the file name.targetDir
- Directory in which to create the temp file. If null, the default temp directory is used.- Returns:
- A file in the temporary directory starting with name, ending with extension, which will be deleted after the program exits.
-
deleteRecursively
Delete rootPath recursively- Parameters:
rootPath
- is the file/directory to be deleted
-