|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.dynalivery.saffron.client.FileUtilities
This class defines some useful methods for manipulating files and filenames.
| Field Summary | |
static int |
BUFFER_SIZE_IN_BYTES
|
| Constructor Summary | |
FileUtilities()
|
|
| Method Summary | |
static void |
copyFile(java.io.File sourceFile,
java.io.File destFile)
Copy a file |
static byte[] |
createByteArrayFromFile(java.io.File file)
Returns a byte array with the entire contents of the specified file |
static byte[] |
createByteArrayFromStream(java.io.InputStream inputStream)
Returns a byte array with the entire contents of the specified file |
static void |
extractZipFile(java.lang.String dirPathname,
java.lang.String zipFilename)
|
static java.io.File |
findFile(java.lang.String filename)
Find a file. |
static java.lang.String |
getLastPathnameElement(java.lang.String pathname)
Get last element of pathname |
static java.util.ArrayList |
getNestedFiles(java.lang.String directory,
java.lang.String filename)
|
static java.lang.String |
getParentPathname(java.lang.String pathname)
Get parent's pathname |
static java.lang.String |
setLastPathnameElement(java.lang.String pathname,
java.lang.String newLastElement)
Set the last element of a pathname |
static void |
writeByteArrayToFile(java.io.File file,
byte[] byteArray)
Writes a byte array to the specified file |
static void |
zipDirectory(java.lang.String dirPathname,
java.lang.String zipFilename,
boolean deleteFiles)
Zip the files in specified directory |
static void |
zipFiles(java.lang.String[] pathnames,
java.lang.String zipFilename,
boolean deleteFiles)
Zip the specified files |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int BUFFER_SIZE_IN_BYTES
| Constructor Detail |
public FileUtilities()
| Method Detail |
public static byte[] createByteArrayFromFile(java.io.File file)
throws java.io.FileNotFoundException,
java.io.IOException
file - the File to be read
java.io.FileNotFoundException
java.io.IOException
public static byte[] createByteArrayFromStream(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - the InputStream to be read
java.io.IOException
public static void writeByteArrayToFile(java.io.File file,
byte[] byteArray)
throws java.io.FileNotFoundException,
java.io.IOException
file - the File to be writtenbyteArray - of the file contents
java.io.FileNotFoundException
java.io.IOExceptionpublic static java.lang.String getParentPathname(java.lang.String pathname)
pathname - full pathname to be parsed
public static java.lang.String getLastPathnameElement(java.lang.String pathname)
pathname - full pathname to be parsed
public static java.lang.String setLastPathnameElement(java.lang.String pathname,
java.lang.String newLastElement)
pathname - full pathname to be parsednewLastElement - the String to replace the last pathname element
public static void copyFile(java.io.File sourceFile,
java.io.File destFile)
throws java.io.IOException
sourceFile - the source FiledestFile - the destination File
java.io.IOExceptionpublic static java.io.File findFile(java.lang.String filename)
filename - the filename we are looking for
public static java.util.ArrayList getNestedFiles(java.lang.String directory,
java.lang.String filename)
public static void zipDirectory(java.lang.String dirPathname,
java.lang.String zipFilename,
boolean deleteFiles)
throws java.io.IOException
dirPathname - the pathname String for the source directoryzipFilename - the filename String for the destination zip filedeleteFiles - true if files should be deleted after zip file is built
java.io.IOException
public static void zipFiles(java.lang.String[] pathnames,
java.lang.String zipFilename,
boolean deleteFiles)
throws java.io.IOException
pathnames - String array of pathname to be deletedzipFilename - the filename String for the destination zip filedeleteFiles - true if files should be deleted after zip file is built
java.io.IOException
public static void extractZipFile(java.lang.String dirPathname,
java.lang.String zipFilename)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||