Class FileStorage

java.lang.Object
one.jpro.platform.file.FileStorage

public final class FileStorage extends Object
Utility class for file storage operations.
Author:
Besmir Beqiri
  • Field Details

    • JPRO_TMP_DIR

      public static final Path JPRO_TMP_DIR
      The directory path to store temporary files. Defaults to a 'tmp' directory within a '.jpro' directory in the user's home directory.
  • Method Details

    • createTempFile

      public static Path createTempFile(@Nullable @Nullable Path dir, @Nullable @Nullable String fileName, @Nullable @Nullable String fileType) throws IOException
      Creates a temporary file in the specified directory with the provided file name and type. If any of the parameters are null, it falls back to default values.
      Parameters:
      dir - the directory in which to create the file, if null, the directory defaults to JPRO_TMP_DIR
      fileName - the name of the file to create. Defaults to "filename" if null
      fileType - the file extension or type. Defaults to ".tmp" if null
      Returns:
      a Path object representing the created file
      Throws:
      IOException - if an I/O error occurs or the file already exists