|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nih.nci.caarray.services.util.fileuploadapplet.Zipper
public class Zipper
This object creates a zip file conaining 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: Zipper myZipper = new Zipper(); myZipper.setFiles(mySelectedFiles); //this method blocks until the zip file is created sendToServer(myZipper.getInputStream()); on server: Zipper.unZip(unpackDirectory, fullyQualifiedZipFileName)
Constructor Summary | |
---|---|
Zipper()
no-arg constructor |
Method Summary | |
---|---|
void |
bytesTransferred(long total,
int lastchunk)
callback method for copy util. |
long |
getBytesCompressed()
return the number of bytes of source dtata files that have been sent to the zip compression function. |
java.lang.String |
getExpId()
|
java.io.InputStream |
getInputStream()
This method gets an InputStream for reading the zip file. |
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 void |
main(java.lang.String[] args)
I should use this to test this. |
void |
setFiles(SelectedFiles files)
This method establishes the set of files to be put into the zip file, and then actually places them in there. |
static boolean |
unZip(java.lang.String rootDir,
java.lang.String zipFile)
unzip ze file relative to the specified directory |
static boolean |
unZip(java.lang.String rootDir,
java.lang.String zipFile,
UploadFile[] uploadFiles)
unzip ze 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 Zipper()
Method Detail |
---|
public java.lang.String getName()
public void setFiles(SelectedFiles 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 java.lang.String getExpId()
public java.io.InputStream getInputStream() throws java.lang.Exception
java.lang.Exception
- if no files are defined, or zip is not built yetpublic long getZipFileSize()
public void bytesTransferred(long total, int lastchunk)
total
- the total number of bytes transfered in this copy calllastchunk
- the number of bytes transferred since the last callbackpublic long getBytesCompressed()
public boolean isCompressing()
public static boolean unZip(java.lang.String rootDir, java.lang.String zipFile)
rootDir
- the directory to unzip the files intozipFile
- the zip file to unzip
public static boolean unZip(java.lang.String rootDir, java.lang.String zipFile, UploadFile[] uploadFiles)
rootDir
- the directory to unzip the files intozipFile
- the zip file to unzip
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 |