public class FileUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeSilently(Closeable closeable)
Utility method that close a Closeable object
|
static Set<String> |
getFeatureFileNamesFromWorkspace(hudson.FilePath workspace,
String path,
hudson.model.TaskListener listener)
This method will return all files with the ".feature" extension within a given build workspace and a path.
|
static List<hudson.FilePath> |
getFeatureFilesFromWorkspace(hudson.FilePath workspace,
String path,
hudson.model.TaskListener listener)
Utility method that returns all .features files from a folder, including those contained in sub folders.
|
static List<hudson.FilePath> |
getFiles(hudson.FilePath workspace,
String globExpression,
hudson.model.TaskListener listener,
hudson.remoting.VirtualChannel channel)
Returns a list of files that matches the glob expression relatively to the workspace or that matches a file path.
|
static boolean |
isApplicableAsModifiedFile(hudson.FilePath filePath,
String lastModified)
Checks if a given file was modified at least 'lastModified' ago.
|
static hudson.FilePath |
readFile(hudson.FilePath workspace,
String filePath,
hudson.model.TaskListener listener)
Given the Jenkins project workspace FilePath and the file path, will resolve the FilePath of the file
|
public static void closeSilently(Closeable closeable)
closeable - the Closeable objectpublic static List<hudson.FilePath> getFeatureFilesFromWorkspace(hudson.FilePath workspace, String path, hudson.model.TaskListener listener) throws IOException, InterruptedException
workspace - the Jenkins project workspacepath - the folder pathlistener - the TaskListenerIOExceptionInterruptedExceptionpublic static Set<String> getFeatureFileNamesFromWorkspace(hudson.FilePath workspace, String path, hudson.model.TaskListener listener) throws IOException, InterruptedException
workspace - the build's workspacepath - the relative or absolute path where to search for the feature fileslistener - the lostener used to write some logsIOException - Exception thrown when file/directory reading the operation failsInterruptedException - Exception thrown when file/directory reading the operation failspublic static List<hudson.FilePath> getFiles(hudson.FilePath workspace, String globExpression, hudson.model.TaskListener listener, hudson.remoting.VirtualChannel channel) throws IOException, InterruptedException
workspace - the workspaceglobExpression - the glob expression. Must be relative to the workspaceIOExceptionInterruptedExceptionpublic static hudson.FilePath readFile(hudson.FilePath workspace,
String filePath,
hudson.model.TaskListener listener)
workspace - the Jenkins workspacefilePath - the file path of the filelistener - the task listenerFilePathpublic static boolean isApplicableAsModifiedFile(hudson.FilePath filePath,
String lastModified)
filePath - the file to check.lastModified - the time threshold.Copyright © 2016–2022. All rights reserved.