Class TestFileUtils
- java.lang.Object
-
- org.eclipse.aether.internal.test.util.TestFileUtils
-
public class TestFileUtils extends java.lang.Object
Provides utility methods to read and write (temporary) files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static longcopyFile(java.io.File source, java.io.File target)static java.io.FilecreateTempDir()Deprecated.use @TempDir (JUnit 5) Or TemporaryFolder (JUnit 4) insteadstatic java.io.FilecreateTempDir(java.lang.String suffix)Deprecated.use@TempDir(JUnit 5) orTemporaryFolder(JUnit 4) insteadstatic java.io.FilecreateTempFile(byte[] pattern, int repeat)Deprecated.static java.io.FilecreateTempFile(java.lang.String contents)Deprecated.use @TempDir (JUnit 5) Or TemporaryFolder (JUnit 4) insteadstatic voiddeleteFile(java.io.File file)static voiddeleteTempFiles()Deprecated.static booleanmkdirs(java.io.File directory)Deprecated.static byte[]readBytes(java.io.File file)Deprecated.useFiles.readAllBytes(Path)insteadstatic voidreadProps(java.io.File file, java.util.Properties props)static java.lang.StringreadString(java.io.File file)static voidwriteBytes(java.io.File file, byte[] pattern, int repeat)Deprecated.static voidwriteProps(java.io.File file, java.util.Properties props)static voidwriteString(java.io.File file, java.lang.String content)Deprecated.static voidwriteString(java.io.File file, java.lang.String content, long timestamp)Deprecated.
-
-
-
Method Detail
-
deleteTempFiles
@Deprecated public static void deleteTempFiles() throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
deleteFile
public static void deleteFile(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
mkdirs
@Deprecated public static boolean mkdirs(java.io.File directory)
Deprecated.
-
createTempFile
@Deprecated public static java.io.File createTempFile(java.lang.String contents) throws java.io.IOException
Deprecated.use @TempDir (JUnit 5) Or TemporaryFolder (JUnit 4) instead- Throws:
java.io.IOException- if an I/O error occurs
-
createTempFile
@Deprecated public static java.io.File createTempFile(byte[] pattern, int repeat) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
createTempDir
@Deprecated public static java.io.File createTempDir() throws java.io.IOException
Deprecated.use @TempDir (JUnit 5) Or TemporaryFolder (JUnit 4) insteadCreates a temporary directory.- Returns:
- the temporary directory
- Throws:
java.io.IOException- if an I/O error occurs
-
createTempDir
@Deprecated public static java.io.File createTempDir(java.lang.String suffix) throws java.io.IOException
Deprecated.use@TempDir(JUnit 5) orTemporaryFolder(JUnit 4) insteadCreates a temporary directory.- Returns:
- the temporary directory
- Throws:
java.io.IOException- if an I/O error occurs
-
copyFile
public static long copyFile(java.io.File source, java.io.File target) throws java.io.IOException
- Throws:
java.io.IOException
-
readBytes
@Deprecated public static byte[] readBytes(java.io.File file) throws java.io.IOException
Deprecated.useFiles.readAllBytes(Path)insteadReads the contents of a file into a byte array.- Parameters:
file- the file to read- Returns:
- the contents of the file as a byte array
- Throws:
java.io.IOException- if an I/O error occurs
-
writeBytes
@Deprecated public static void writeBytes(java.io.File file, byte[] pattern, int repeat) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
readString
public static java.lang.String readString(java.io.File file) throws java.io.IOException
- Throws:
java.io.IOException
-
writeString
@Deprecated public static void writeString(java.io.File file, java.lang.String content) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
writeString
@Deprecated public static void writeString(java.io.File file, java.lang.String content, long timestamp) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
readProps
public static void readProps(java.io.File file, java.util.Properties props) throws java.io.IOException
- Throws:
java.io.IOException
-
writeProps
public static void writeProps(java.io.File file, java.util.Properties props) throws java.io.IOException
- Throws:
java.io.IOException
-
-