|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.util.FileUtils
public class FileUtils
Field Summary | |
---|---|
protected static java.util.logging.Logger |
logger
|
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static void |
copy(java.io.File fromFile,
java.io.File toFile,
int bufSize)
Copy a file to another location, byte-wise. |
static void |
deleteFile(java.io.File file)
Delete a file or a directory, including its content. |
static javax.swing.JFileChooser |
getChooser(java.lang.String title)
|
static java.lang.String |
getFilePathToOpenFromUser(java.lang.String title)
|
static java.lang.String |
getFilePathToOpenFromUser(java.lang.String title,
javax.swing.filechooser.FileFilter ff)
|
static java.lang.String |
getFilePathToSaveFromUser(java.lang.String title)
|
static java.lang.String |
getPathToOpenFromUser(java.lang.String title,
javax.swing.filechooser.FileFilter ff,
int fileSelectionMode,
java.lang.String acceptButtonText)
|
static java.lang.String |
handleResponse(javax.swing.JFileChooser chooser,
int state)
|
static void |
openZipFile(java.lang.String zipFileName,
java.io.File toDir,
boolean deleteAfter)
Unpack a zip file. |
static void |
saveZipFile(java.lang.String zipFileName,
java.io.File toBeZipped)
Create a zip file containing the given File. |
static void |
saveZipFile(java.lang.String zipFileName,
java.util.List<java.io.File> toBeZipped)
Create a zip file containing the files in the list. |
protected static void |
unzip(java.util.zip.ZipInputStream zin,
java.io.File f)
|
static void |
writeZipEntry(java.io.File toBeZipped,
java.util.zip.ZipOutputStream zoStream,
int prefixTrimLength)
Writes a file to the jar stream. |
protected static void |
writeZipEntry(java.io.File fromFile,
java.util.zip.ZipOutputStream zoStream,
java.lang.String entryName)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.logging.Logger logger
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static java.lang.String getFilePathToSaveFromUser(java.lang.String title)
public static java.lang.String getFilePathToOpenFromUser(java.lang.String title)
public static java.lang.String getFilePathToOpenFromUser(java.lang.String title, javax.swing.filechooser.FileFilter ff)
public static java.lang.String getPathToOpenFromUser(java.lang.String title, javax.swing.filechooser.FileFilter ff, int fileSelectionMode, java.lang.String acceptButtonText)
public static javax.swing.JFileChooser getChooser(java.lang.String title)
public static java.lang.String handleResponse(javax.swing.JFileChooser chooser, int state)
public static void copy(java.io.File fromFile, java.io.File toFile, int bufSize) throws java.io.IOException
fromFile
- the File to copy from.toFile
- the File to copy to.bufSize
- the byte size of the transfer buffer.
java.io.IOException
- Thrown if anything goes wrong.public static void deleteFile(java.io.File file) throws java.io.IOException
file
- file to delete
java.io.IOException
- if there's a problempublic static void saveZipFile(java.lang.String zipFileName, java.io.File toBeZipped) throws java.io.IOException, java.io.FileNotFoundException
zipFileName
- The path to the zip file. If it doesn't end in .zip,
.zip will be added to it.toBeZipped
- The Path of the file/directory to be zipped.
java.io.IOException
- if there's a problem
java.io.FileNotFoundException
- if there's a problempublic static void saveZipFile(java.lang.String zipFileName, java.util.List<java.io.File> toBeZipped) throws java.io.IOException, java.io.FileNotFoundException
zipFileName
- The path to the zip/jar file.toBeZipped
- The List of files to be placed in the zip/jar.
java.io.IOException
- if there's a problem
java.io.FileNotFoundException
- if there's a problempublic static void writeZipEntry(java.io.File toBeZipped, java.util.zip.ZipOutputStream zoStream, int prefixTrimLength) throws java.io.IOException
toBeZipped
- the file to be writtenzoStream
- the stream to write it to, prepared for the
ZipFile/JarFileprefixTrimLength
- The number of characters to trim off the absolute
path of the file to be zipped. Can be useful to adjust this to
adjust the directory depth of the entry for when it is unpacked.
If less than 0, only the file name will be used.
java.io.IOException
- if there's a problemprotected static void writeZipEntry(java.io.File fromFile, java.util.zip.ZipOutputStream zoStream, java.lang.String entryName) throws java.io.IOException
java.io.IOException
public static void openZipFile(java.lang.String zipFileName, java.io.File toDir, boolean deleteAfter)
zipFileName
- The path name of the zip file to unpack.toDir
- the directory to put the unpacked files in.deleteAfter
- flag to delete the zip file when complete.protected static void unzip(java.util.zip.ZipInputStream zin, java.io.File f) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |