
ai.digital.integration.server.util.FileUtil.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of integratoin-server-gradle-plugin Show documentation
Show all versions of integratoin-server-gradle-plugin Show documentation
The easy way to get custom setup for Deploy up and running
The newest version!
package ai.digital.integration.server.util
import org.apache.commons.io.IOUtils
import java.nio.file.Path
import java.nio.file.Paths
class FileUtil {
static def copyFile(InputStream source, Path dest) {
def parentDir = dest.getParent().toFile()
if (!parentDir.exists()) {
parentDir.mkdirs()
}
def destFile = dest.toFile()
destFile.createNewFile()
def os = new FileOutputStream(destFile)
try {
IOUtils.copy(source, os)
} finally {
os.close()
}
}
static def pathToString(Path path) {
path.toAbsolutePath().toString()
}
static def toPathString(Path path, String subDir) {
pathToString(Paths.get(pathToString(path), subDir))
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy