Package io.quarkus.bootstrap.util
Class IoUtils
java.lang.Object
io.quarkus.bootstrap.util.IoUtils
- Author:
- Alexey Loubyansky
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopy(OutputStream out, InputStream in) Copy the input stream to the given output stream.static Pathstatic voidcreateOrEmptyDir(Path dir) Creates a new empty directory or empties an existing one.static PathcreateRandomDir(Path parentDir) static Pathstatic PathcreateTmpDir(String name) static Pathstatic StringDeprecated, for removal: This API element is subject to removal in a future version.static voidrecursiveDelete(Path root) Recursively delete the file or directory given byroot.static voidWrite a string to a file using UTF-8 encoding.
-
Constructor Details
-
IoUtils
public IoUtils()
-
-
Method Details
-
createTmpDir
-
createRandomTmpDir
-
createRandomDir
-
mkdirs
-
recursiveDelete
Recursively delete the file or directory given byroot. The implementation will attempt to do so in a secure manner. Any problems encountered will be logged atDEBUGlevel.- Parameters:
root- the root path (must not benull)
-
createOrEmptyDir
Creates a new empty directory or empties an existing one. Any problems encountered while emptying the directory will be logged atDEBUGlevel.- Parameters:
dir- directory- Throws:
IOException- if creating or accessing the directory itself fails
-
copy
- Throws:
IOException
-
readFile
Deprecated, for removal: This API element is subject to removal in a future version.UseFiles.readString(Path, Charset)instead.Read the contents of a file as a string.- Parameters:
file- the file to read (must not benull)- Returns:
- the file content, as a string (not
null) - Throws:
IOException- if an error occurs when reading the file
-
copy
Copy the input stream to the given output stream. Calling this method is identical to callingin.transferTo(out).- Parameters:
out- the output stream (must not benull)in- the input stream (must not benull)- Throws:
IOException- if an error occurs during the copy- See Also:
-
writeFile
Write a string to a file using UTF-8 encoding. The file will be created if it does not exist, and truncated if it is not empty.- Parameters:
file- the file to write (must not benull)content- the string to write to the file (must not benull)- Throws:
IOException- if an error occurs when writing the file
-
Files.readString(Path, Charset)instead.