Class TempPath

java.lang.Object
velox.api.layer1.common.temporaryfiles.TempPath
All Implemented Interfaces:
Closeable, AutoCloseable

public class TempPath extends Object implements Closeable
Represents a temporary file or dir and its associated lock. Lock is created in the constructor and released by calling dispose(boolean) or close(). The lock is set on a separate file.
See Also:
  • Constructor Details

  • Method Details

    • get

      public Path get()
      Returns:
      The managed path, in absolute, normalized form.
    • createFile

      public Path createFile() throws IOException
      Create a file for the managed path and return it.
      Throws:
      IOException
    • createDirectory

      public Path createDirectory() throws IOException
      Create a directory for the managed path and return it.
      Throws:
      IOException
    • dispose

      public void dispose(boolean deletePath) throws IOException
      Releases the lock associated with this path.

      If an exception gets thrown during an intermediary step, all the files will get cleaned up during root temp dir cleanup anyway.

      Parameters:
      deletePath - if true, also deletes the managed file or directory, recursively.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object