Class TemporaryDirectory

java.lang.Object
org.verifyica.api.TemporaryDirectory
All Implemented Interfaces:
AutoCloseable

public class TemporaryDirectory extends Object implements AutoCloseable
Class to implement TemporaryDirectory
  • Method Details

    • toFile

      public File toFile()
      Get the temporary directory File
      Returns:
      the temporary directory File
    • toPath

      public Path toPath()
      Get the temporary directory Path
      Returns:
      the temporary directory Path
    • close

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

      public void delete() throws IOException
      Method to delete the temporary directory
      Throws:
      IOException - IOException
    • newFile

      public File newFile() throws IOException
      Method to create a new file in the temporary directory, using the permissions set for the temporary directory
      Returns:
      the new file
      Throws:
      IOException - IOException
    • newFile

      public File newFile(Set<PosixFilePermission> posixFilePermissions) throws IOException
      Method to create a new file in the temporary directory with specified permissions
      Parameters:
      posixFilePermissions - the permissions to set for the new file
      Returns:
      the new file
      Throws:
      IOException - If an I/O error occurs
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • newDirectory

      public static TemporaryDirectory newDirectory() throws IOException
      Method to create a new temporary directory with default permissions
      Returns:
      a new TemporaryDirectory
      Throws:
      IOException - If an I/O error occurs
    • newDirectory

      public static TemporaryDirectory newDirectory(Set<PosixFilePermission> posixFilePermissions) throws IOException
      Method to create a new temporary directory with specified POSIX file permissions
      Parameters:
      posixFilePermissions - the POSIX file permissions to set for the temporary directory
      Returns:
      a new TemporaryDirectory
      Throws:
      IOException - If an I/O error occurs