public class FileUtils
extends java.lang.Object
| Constructor and Description |
|---|
FileUtils(org.gradle.api.logging.Logger logger) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkAndCreateDirectory(java.io.File dir)
Check and create directory.
|
void |
checkAndCreateDirectory(java.lang.String dirPath)
Check and create directory.
|
boolean |
checkFileContains(java.nio.file.Path filePath,
java.lang.String stringPattern)
check file contains.
|
java.util.Set<java.nio.file.Path> |
findFiles(java.lang.String path,
java.lang.String pattern)
Find files in path.
|
java.util.Set<java.lang.String> |
findPatternsInFile(java.nio.file.Path filePath,
java.lang.String regexPattern)
find match patterns in file path.
|
java.lang.String |
getFileContent(java.nio.file.Path filePath)
get file content.
|
java.io.File |
getFileFromResource(java.lang.String resourcePath)
Get file from resource.
|
java.util.List<java.nio.file.Path> |
listDirFilePaths(java.lang.String directory)
List dir file paths.
|
void |
unTarZip(java.lang.String resourcePath,
java.lang.String outputPath,
boolean overwrite)
Un-TarZip a tgz file.
|
void |
writeResourceAsExecutable(java.io.InputStream inputStream,
java.lang.String outputFile)
Write resource as executable.
|
void |
writeResourceAsExecutable(java.lang.String resourcePath,
java.lang.String outputFile)
Write resource as executable.
|
void |
writeResourceToFile(java.io.InputStream inputStream,
java.lang.String outputFile,
boolean overwrite)
Write resource to file.
|
void |
writeResourceToFile(java.lang.String resourcePath,
java.lang.String outputFile,
boolean overwrite)
Write resource to file.
|
public void checkAndCreateDirectory(java.lang.String dirPath)
throws java.io.IOException
dirPath - directory pathjava.io.IOException - IOExceptionpublic void checkAndCreateDirectory(java.io.File dir)
throws java.io.IOException
dir - directory filejava.io.IOException - IOExceptionpublic void writeResourceToFile(java.lang.String resourcePath,
java.lang.String outputFile,
boolean overwrite)
outputFile - output fileoverwrite - overwrite flagpublic void writeResourceToFile(java.io.InputStream inputStream,
java.lang.String outputFile,
boolean overwrite)
throws java.io.IOException
inputStream - input streamoutputFile - output fileoverwrite - overwrite flagjava.io.IOException - IOExceptionpublic void writeResourceAsExecutable(java.lang.String resourcePath,
java.lang.String outputFile)
throws java.io.IOException
resourcePath - resource pathoutputFile - output filejava.io.IOException - IOExceptionpublic void writeResourceAsExecutable(java.io.InputStream inputStream,
java.lang.String outputFile)
throws java.io.IOException
inputStream - input streamoutputFile - output filejava.io.IOException - IOExceptionpublic java.util.List<java.nio.file.Path> listDirFilePaths(java.lang.String directory)
throws java.io.IOException
directory - directoryjava.io.IOException - IOExceptionpublic java.io.File getFileFromResource(java.lang.String resourcePath)
throws java.io.IOException
resourcePath - resource pathjava.io.IOException - IOExceptionpublic void unTarZip(java.lang.String resourcePath,
java.lang.String outputPath,
boolean overwrite)
throws java.io.IOException
resourcePath - resource pathoutputPath - output pathoverwrite - overwrite flagjava.io.IOException - IOExceptionpublic java.util.Set<java.nio.file.Path> findFiles(java.lang.String path,
java.lang.String pattern)
throws java.io.IOException
path - find pathpattern - find pattternjava.io.IOException - IOExceptionpublic boolean checkFileContains(java.nio.file.Path filePath,
java.lang.String stringPattern)
throws java.io.IOException
filePath - input filestringPattern - string patternjava.io.IOException - io exceptionpublic java.lang.String getFileContent(java.nio.file.Path filePath)
throws java.io.IOException
filePath - file pathjava.io.IOException - io exceptionpublic java.util.Set<java.lang.String> findPatternsInFile(java.nio.file.Path filePath,
java.lang.String regexPattern)
throws java.io.IOException
filePath - file pathregexPattern - regex patternjava.io.IOException - io exception