Class TemporaryPath

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class TemporaryPath
    extends java.lang.Object
    implements java.io.Closeable
    When you are opening a path with try-with-resources that you want to be deleted on close.
    • Constructor Detail

      • TemporaryPath

        public TemporaryPath​(java.nio.file.Path file)
    • Method Detail

      • getPath

        public java.nio.file.Path getPath()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • safeClose

        public void safeClose()
        Closes (deletes) the temporary file and suppresses any IO exception that may or may not occur.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • tempFile

        public static TemporaryPath tempFile​(java.nio.file.Path baseDir)
      • tempFile

        public static TemporaryPath tempFile​(java.lang.String prefix)
      • tempFile

        public static TemporaryPath tempFile​(java.nio.file.Path baseDir,
                                             java.lang.String prefix)
      • tempFile

        public static TemporaryPath tempFile​(java.lang.String prefix,
                                             java.lang.String suffix)
      • tempFile

        public static TemporaryPath tempFile​(java.nio.file.Path baseDir,
                                             java.lang.String prefix,
                                             java.lang.String suffix)
      • tempDirectory

        public static TemporaryPath tempDirectory​(java.nio.file.Path baseDir)
      • tempDirectory

        public static TemporaryPath tempDirectory​(java.lang.String prefix)
      • tempDirectory

        public static TemporaryPath tempDirectory​(java.nio.file.Path baseDir,
                                                  java.lang.String prefix)