|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nih.nci.caarray.services.util.file.FileZipper
public class FileZipper
This object creates a zip file containing the set of files within a SelectedFiles object. One can then get an InputStream for the zip file to use for transfering via FTP. This object also contains an unzip method to extract the files from the zip file. There is also support for determining how much of the zipping has been done (ie number of bytes read from the source file) Typical use would be: FileZipper myZipper = new FileZipper(); myZipper.setFiles(mySelectedFiles); //this method blocks until the zip file is created sendToServer(myZipper.getInputStream()); on server: Zipper.unZip(unpackDirectory, fullyQualifiedZipFileName)
Constructor Summary | |
---|---|
FileZipper()
|
Method Summary | |
---|---|
static void |
createZip(java.lang.String zipFilePathName,
java.lang.String[] filePathNames,
boolean noPath)
Creates a zip file and adds the specified fileNames to it. |
long |
getBytesCompressed()
return the number of bytes of source dtata files that have been sent to the zip compression function. |
java.lang.String |
getName()
Method to get the name of the zip file. |
long |
getZipFileSize()
Get the size of the zip file created by this class |
boolean |
isCompressing()
Is this object currently compressing data files ? |
static boolean |
isZipFile(java.lang.String pathName)
Checks if the specified file is a compressed zip file. |
static void |
main(java.lang.String[] args)
Use this for testing. |
void |
setFiles(java.lang.String sessIdent,
java.io.File[] files)
This method establishes the set of files to be put into the zip file, and then actually places them in there. |
static java.lang.String[] |
unZip(java.lang.String targetDirectory,
java.lang.String zipFilePath)
unzip a file relative to the specified directory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileZipper()
Method Detail |
---|
public java.lang.String getName()
public void setFiles(java.lang.String sessIdent, java.io.File[] files) throws java.lang.Exception
files
- the files to place into the zip filesessIdent
- the session Identifier. used to construct the path in the zip file.
java.lang.Exception
- if an error occurs during zip buildingpublic long getZipFileSize()
public long getBytesCompressed()
public boolean isCompressing()
public static final java.lang.String[] unZip(java.lang.String targetDirectory, java.lang.String zipFilePath) throws java.io.IOException
targetDirectory
- the directory to unzip the files intozipFilePath
- the zip file to unzip
java.io.IOException
public static void createZip(java.lang.String zipFilePathName, java.lang.String[] filePathNames, boolean noPath) throws java.io.IOException
fileNames
to it. tranp
zipFileName
- fileNames
- noPath
- - True to indicate all files are put at the root of the zip files.
java.io.IOException
public static final boolean isZipFile(java.lang.String pathName)
pathName
-
public static void main(java.lang.String[] args)
args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |