|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.util.Files
Commonly used file utilities.
Field Summary | |
static int |
IGNORE_EXISTING
|
static int |
OVERWRITE
|
static int |
UPDATE
|
static String |
versionId
|
Method Summary | |
static void |
copy(File from,
File to)
|
static void |
copy(File from,
File to,
int mode)
|
static void |
delete(File file)
|
static String |
getPrettySize(File file)
This will take in a file and return the pretty size in human readable terms. |
static String |
getPrettySize(long longSize)
This will take in a file and return the pretty size in human readable terms. |
static String[] |
listFilesInTree(File baseDirectory,
FilenameFilter filter)
This recursively builds a list of file paths, including all files that meet the requirements of the file filter, if specified. |
static void |
writeZipFile(OutputStream outputStream,
String[] fileList,
File baseFile)
This writes a zip file to the given output stream and has several options for how the file should be written. |
static void |
writeZipFile(String outputFileName,
String[] includedFiles,
File baseFile)
A convenience method that will create a FileOutputStream so that the zip file can be written to outputFileName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
public static final int OVERWRITE
public static final int UPDATE
public static final int IGNORE_EXISTING
Method Detail |
public static void delete(File file)
public static void copy(File from, File to) throws IOException
IOException
public static void copy(File from, File to, int mode) throws IOException
IOException
public static void writeZipFile(String outputFileName, String[] includedFiles, File baseFile)
public static void writeZipFile(OutputStream outputStream, String[] fileList, File baseFile)
outputStream
- The output stream to write the file.
This is typically the response output stream
if the file is download or a FileOutputStream if
it is written to disk.fileList
- A string list of the files to be included in the
zip file. The strings are relative to the
baseFile or are absolute if the baseFile is null.baseFile
- The file that is used as the base of the zip.
This basically allows us to "cd" to the directory
and then perform the "zip" from that directory
as opposed to doing everything from "/".public static String[] listFilesInTree(File baseDirectory, FilenameFilter filter)
public static String getPrettySize(File file)
public static String getPrettySize(long longSize)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |