Package com.atlassian.bamboo.testutils
Class TempDirectory
java.lang.Object
java.io.File
com.atlassian.bamboo.testutils.TempDirectory
- All Implemented Interfaces:
Serializable
,Comparable<File>
- See Also:
-
Field Summary
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull File
createSecureTempFile
(@NotNull String prefix, long size) Creates a secure temporary file with a specific size The file is created with security attributes ensuring it is only accessible by the ownerstatic @NotNull File
createSecureTempFile
(@NotNull String prefix, @Nullable String content, byte byteValue, long repeatKBSize, boolean randomize, boolean compressData) 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 suffixvoid
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
-
Constructor Details
-
TempDirectory
- Throws:
IOException
-
TempDirectory
- Throws:
IOException
-
-
Method Details
-
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 longsize
- 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 suffixcontent
- The string content to write, or null if writing repeated bytes, random data, or compressed databyteValue
- The byte value to fill the data with, ignored if content is not null or if writing random/compressed datarepeatKBSize
- 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 bytescompressData
- 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
-
deleteAll
- Throws:
IOException
-
mkdir
- Throws:
IOException
-
mkfile
- Throws:
IOException
-
mkfile
- Throws:
IOException
-