Class TempDirectory

    • Method Detail

      • createSecureTempFile

        @NotNull
        public static @NotNull File createSecureTempFile​(@NotNull
                                                         @NotNull String prefix,
                                                         long size)
                                                  throws IOException
        Creates a secure temporary file with a specific size The file is created with security attributes ensuring it is only accessible by the owner
        Parameters:
        prefix - The prefix string to be used in generating the file's name; must be at least three characters long
        size - The desired size of the file in bytes
        Returns:
        The created temporary File
        Throws:
        IOException - If an I/O error occurs during file creation or writing
      • createSecureTempFile

        @NotNull
        public static @NotNull File createSecureTempFile​(@NotNull
                                                         @NotNull String prefix,
                                                         @Nullable
                                                         @Nullable String content,
                                                         byte byteValue,
                                                         long repeatKBSize,
                                                         boolean randomize,
                                                         boolean compressData)
                                                  throws IOException
        Creates a secure temporary file with specified content and attributes The file is created with security attributes ensuring it is only accessible by the owner The method allows writing either a specified string, repeated bytes, random data, or compressed data to the file If the prefix contains an extension (e.g., "tempFile.txt"), that extension will be used as the file's suffix
        Parameters:
        prefix - The prefix string to be used in generating the file's name Must be at least three characters long. If it contains an extension (e.g., ".txt"), that extension will be used as the file's suffix
        content - The string content to write, or null if writing repeated bytes, random data, or compressed data
        byteValue - The byte value to fill the data with, ignored if content is not null or if writing random/compressed data
        repeatKBSize - The size in kilobytes to write if content is null; ignored if content is not null or if writing random/compressed data.
        randomize - If true, write random data instead of repeated bytes
        compressData - If true, compress the data before writing to the file
        Returns:
        The created temporary File
        Throws:
        IOException - If an I/O error occurs during file creation or writing