|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectqat.common.Utils
Constructor Summary | |
Utils()
|
Method Summary | |
static void |
cat(java.lang.String fileName)
This writes the file specified by fileName to the stdout. |
static void |
checkSubDirsExist(java.lang.String path)
Creates all neccesary parent directories contained in this path. |
static void |
cleanUnzippedFiles(java.lang.String zipFileName,
java.lang.String outputDirectory)
This method deletes all the files and subdirectories as created when the zipFileName was unzipped in the outputDirectory. |
static void |
copy(java.lang.String sourceName,
java.lang.String destName)
This method copies sourceName to destName. |
static java.io.File |
createTempFile(java.lang.String prefix,
java.lang.String suffix)
|
static void |
delete(java.io.File node)
This method deletes the file specified by fileName. |
static void |
delete(java.lang.String fileName)
This method deletes the file specified by fileName. |
static java.lang.String |
ensureSuffix(java.lang.String fileName,
java.lang.String suffix)
This method appends the specified suffix to the fileName if it doesn't already have it. |
static java.lang.String |
extractFileName(java.lang.String path)
This method extracts the fileName portion from the specified path. |
static java.lang.String |
extractPath(java.lang.String path)
This method extracts the path portion from the given parameter. |
static int |
getUniqueID()
This method is used to allocate unique identifiers. |
static java.util.Properties |
mergeProperties(java.util.Properties propertiesDest,
java.util.Properties propertiesSource)
Merge the properties of propertiesSource with those of propertiesDest. |
static void |
microSleep(int milliseconds)
This method will block until the specified number of seconds elapsed, as measured by the system clock. |
static java.lang.String |
pad(java.lang.String str,
int length)
This method will pad the string to the specified length with spaces. |
static java.io.File |
parent(java.io.File f)
This method returns the absolute path of the parent of the file specified by f. |
static java.lang.String |
removeSuffix(java.lang.String fileName)
This method removes the file suffix, if it exists, from the parameter fileName. |
static void |
safeSleep(long seconds)
This method will block until the specified number of seconds elapsed, as measured by the system clock. |
static java.lang.String[] |
toStringArray(java.lang.String s)
This breaks up a list of strings into a string array. |
static void |
touch(java.lang.String fileName)
This method creates a file specified by fileName, if it doesn't already exist. |
static void |
touchDir(java.lang.String dirName)
This method creates a dir specified by dirName, if it doesn't already exist. |
static java.lang.String |
trimFileName(java.lang.String path,
int max)
This method ensures the path is never longer than max characters. |
static void |
unzipFiles(java.lang.String zipFileName,
java.lang.String outputDirectory)
This methods will unzip all the files contained in zipFileName, placing them in a position offset with directory outputDirectory. |
static void |
zipFiles(java.lang.String zipFileName,
java.lang.String[] fileList)
This method will create a new zip file zipFileName, or overwrite an existing one, and place in it all the files specified in fileList. |
static void |
zipFiles(java.lang.String zipFileName,
java.lang.String[] fileList,
java.lang.String[] fileNameInZip)
This method will create a new zip file zipFileName, or overwrite an existing one, and place in it all the files specified in fileList. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Utils()
Method Detail |
public static void zipFiles(java.lang.String zipFileName, java.lang.String[] fileList) throws java.io.IOException
zipFileName
- the name of the zip file we want to create.fileList
- an array containing the absolute path names of the files or directories to store in this zip file.
java.io.IOException
- thrown if the file could not be created, or we cannot read some of the input files.public static void zipFiles(java.lang.String zipFileName, java.lang.String[] fileList, java.lang.String[] fileNameInZip) throws java.io.IOException
zipFileName
- the name of the zip file we want to create.fileList
- an array containing the absolute path names of the files or directories to store in this zip file.fileNameInZip
- the exact name to call the entry in the zip file, if it is different to the name in fileList.
java.io.IOException
- thrown if the file could not be created, or we cannot read some of the input files.public static void unzipFiles(java.lang.String zipFileName, java.lang.String outputDirectory) throws java.io.IOException
zipFileName
- the name of the zip file we want to extract.outputDirectory
- the name of the directory in which to extract the files.
java.io.IOException
- thrown if the file could not be unzipped, or we cannot write in the output directory.public static void cleanUnzippedFiles(java.lang.String zipFileName, java.lang.String outputDirectory) throws java.io.IOException
java.io.IOException
public static void touch(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the file to create.
java.io.IOException
- thrown if any IOException occur due to permission problems etc.public static void touchDir(java.lang.String dirName) throws java.io.IOException
dirName
- the name of the dir to create.
java.io.IOException
- thrown if any IOException occur due to permission problems etc.public static void cat(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the file to be written to stdout.
java.io.IOException
- thrown if the file does not exist, or cannot be read.public static void copy(java.lang.String sourceName, java.lang.String destName) throws java.io.IOException
sourceName
- the name of the source file/directory to be copied.destName
- the name of the destination file/directory.
java.io.IOException
- thrown if any of the files cannot be read or written.public static void delete(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the file or directory to be deleted.
java.io.IOException
- thrown if the file or directory could not be deleted.public static void delete(java.io.File node) throws java.io.IOException
node
- the File identifier of the file or directory to be deleted.
java.io.IOException
- thrown if the file or directory could not be deleted.public static java.lang.String[] toStringArray(java.lang.String s)
public static void safeSleep(long seconds)
seconds
- the number of seconds to sleep for.public static void microSleep(int milliseconds)
public static java.lang.String pad(java.lang.String str, int length)
str
- the String to pad.length
- the desired length of the string.public static java.io.File parent(java.io.File f)
f
- the name of the file whose parent we seek.public static void checkSubDirsExist(java.lang.String path)
public static java.lang.String extractFileName(java.lang.String path)
public static java.lang.String trimFileName(java.lang.String path, int max)
public static java.lang.String extractPath(java.lang.String path)
public static java.lang.String ensureSuffix(java.lang.String fileName, java.lang.String suffix)
public static java.lang.String removeSuffix(java.lang.String fileName)
public static int getUniqueID()
public static java.util.Properties mergeProperties(java.util.Properties propertiesDest, java.util.Properties propertiesSource)
public static java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |