jenkins.plugins.shiningpanda.utils
Class FilePathUtil

java.lang.Object
  extended by jenkins.plugins.shiningpanda.utils.FilePathUtil

public class FilePathUtil
extends Object


Nested Class Summary
static class FilePathUtil.Read
          Get a file contents.
 
Constructor Summary
FilePathUtil()
           
 
Method Summary
static boolean differ(hudson.FilePath filePath1, hudson.FilePath filePath2)
          Check if two files are equal.
static hudson.FilePath existsOrNull(hudson.FilePath... filePaths)
          Get the first existing file or directory.
static boolean isDirectory(hudson.FilePath filePath)
          Check if the provided path is a directory
static hudson.FilePath isDirectoryOrNull(hudson.FilePath... filePaths)
          Get the first existing directory.
static boolean isFile(hudson.FilePath filePath)
          Check if the provided path is a file
static hudson.FilePath isFileOrNull(hudson.FilePath... filePaths)
          Get the first existing file.
static boolean isUnix(hudson.FilePath filePath)
          Is this file located on UNIX?
static boolean isWindows(hudson.FilePath filePath)
          Is this file located on Windows?
static List<hudson.FilePath> listSharedLibraries(hudson.FilePath filePath)
          List shared libraries contained in this folder.
static List<hudson.FilePath> listSharedLibraries(Python interpreter)
          List the shared libraries of the provided interpreter.
static String read(hudson.FilePath filePath, String encoding)
          Get the content of the provided file path.
static hudson.FilePath synchronize(hudson.FilePath src, hudson.FilePath dest)
          Synchronize a file or all files in a directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePathUtil

public FilePathUtil()
Method Detail

isWindows

public static boolean isWindows(hudson.FilePath filePath)
                         throws IOException,
                                InterruptedException
Is this file located on Windows?

Parameters:
filePath - The file to check
Returns:
true if the file is on Windows, else false
Throws:
IOException
InterruptedException

isUnix

public static boolean isUnix(hudson.FilePath filePath)
                      throws IOException,
                             InterruptedException
Is this file located on UNIX?

Parameters:
filePath - The file to check
Returns:
true if the file is on UNIX, else false
Throws:
IOException
InterruptedException

read

public static String read(hudson.FilePath filePath,
                          String encoding)
                   throws IOException,
                          InterruptedException
Get the content of the provided file path.

Parameters:
filePath - The file path
encoding - The encoding
Returns:
The content of the file
Throws:
IOException
InterruptedException

existsOrNull

public static hudson.FilePath existsOrNull(hudson.FilePath... filePaths)
                                    throws IOException,
                                           InterruptedException
Get the first existing file or directory.

Parameters:
filePaths - The list of files or directories to check
Returns:
The first existing file or directory, else null
Throws:
IOException
InterruptedException

isDirectoryOrNull

public static hudson.FilePath isDirectoryOrNull(hudson.FilePath... filePaths)
                                         throws IOException,
                                                InterruptedException
Get the first existing directory.

Parameters:
filePaths - The list of directories to check
Returns:
The first existing directory, else null
Throws:
IOException
InterruptedException

isFileOrNull

public static hudson.FilePath isFileOrNull(hudson.FilePath... filePaths)
                                    throws IOException,
                                           InterruptedException
Get the first existing file.

Parameters:
filePaths - The list of files to check
Returns:
The first existing file, else null
Throws:
IOException
InterruptedException

differ

public static boolean differ(hudson.FilePath filePath1,
                             hudson.FilePath filePath2)
                      throws IOException,
                             InterruptedException
Check if two files are equal.

Parameters:
filePath1 - The first file
filePath2 - The second file
Returns:
true if the files are equal, false if files differ
Throws:
IOException
InterruptedException

isFile

public static boolean isFile(hudson.FilePath filePath)
                      throws IOException,
                             InterruptedException
Check if the provided path is a file

Parameters:
filePath - The file to check
Returns:
true if this is a file, else false
Throws:
IOException
InterruptedException

isDirectory

public static boolean isDirectory(hudson.FilePath filePath)
                           throws IOException,
                                  InterruptedException
Check if the provided path is a directory

Parameters:
filePath - The path to check
Returns:
true if this is a directory, else false
Throws:
IOException
InterruptedException

synchronize

public static hudson.FilePath synchronize(hudson.FilePath src,
                                          hudson.FilePath dest)
                                   throws IOException,
                                          InterruptedException
Synchronize a file or all files in a directory.

Parameters:
src - The source file or directory
dest - The destination file or directory
Returns:
The destination file or directory
Throws:
IOException
InterruptedException

listSharedLibraries

public static List<hudson.FilePath> listSharedLibraries(Python interpreter)
                                                 throws IOException,
                                                        InterruptedException
List the shared libraries of the provided interpreter.

Parameters:
interpreter - The interpreter
Returns:
The list of shared libraries
Throws:
InterruptedException
IOException

listSharedLibraries

public static List<hudson.FilePath> listSharedLibraries(hudson.FilePath filePath)
                                                 throws IOException,
                                                        InterruptedException
List shared libraries contained in this folder.

Parameters:
filePath - The folder
Returns:
The list of libraries
Throws:
IOException
InterruptedException


Copyright © 2004-2012. All Rights Reserved.