Package picard.nio

Class GATKIOUtils

java.lang.Object
picard.nio.GATKIOUtils

public class GATKIOUtils extends Object
  • Constructor Details

    • GATKIOUtils

      public GATKIOUtils()
  • Method Details

    • deleteOnExit

      public static void deleteOnExit(Path fileToDelete)
      Schedule a file or directory to be deleted on JVM shutdown. This calls deleteRecursively(Path) on fileToDelete as a shutdown hook.
      Parameters:
      fileToDelete - file or directory to be deleted recursively at JVM shutdown.
    • getPath

      public static Path getPath(String uriString)
      Converts the given URI to a Path 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
    • createTempFile

      public static 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.
      Parameters:
      name - Prefix of the file; File.createTempFile(String, String, File) requires that this be >= 3 characters
      extension - 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

      public 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.
      Parameters:
      name - Prefix of the file; File.createTempFile(String, String, File) requires that this be >= 3 characters
      extension - 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

      public static void deleteRecursively(Path rootPath)
      Delete rootPath recursively
      Parameters:
      rootPath - is the file/directory to be deleted