Project CASUAL
API for CASUAL
 All Classes Namespaces Functions Variables
Public Member Functions | List of all members
CASUAL.archiving.Zip Class Reference

Public Member Functions

 Zip (CASUALSessionData sd, File zip) throws IOException
 
String getTempFolder ()
 
void addToTempFolderLoc (String TempFolder)
 
void addFilesToExistingZip (String fileToAdd) throws IOException
 
void addFilesToExistingZip (String[] filesToBeZipped) throws IOException
 
void addFilesToExistingZip (File fileToAdd) throws IOException
 
void addFilesToExistingZip (File[] files) throws IOException
 
void streamEntryToExistingZip (InputStream in, String name) throws IOException
 
void injectZip (String injectionZip)
 
void injectZip (File injectionZip)
 
void injectZip (File injectionZip, String injectionPath)
 
File streamEntryToExistingZip (Map< String, InputStream > nameStream) throws IOException
 
void addFolderFilesToNewZip (String newZip, String toBeZipped) throws Exception
 
void addFileToZipDIr (File file) throws IOException
 
void compressZipDir (String file) throws FileNotFoundException, IOException
 
void compressZipDir () throws FileNotFoundException, IOException
 
void zipDir (String directory, ZipOutputStream zos, String path) throws IOException
 
void removeAllEntries ()
 
 Zip (CASUALSessionData sd, File zip) throws IOException
 
String getTempFolder ()
 
void addToTempFolderLoc (String TempFolder)
 
void addFilesToExistingZip (String fileToAdd) throws IOException
 
void addFilesToExistingZip (String[] filesToBeZipped) throws IOException
 
void addFilesToExistingZip (File fileToAdd) throws IOException
 
void addFilesToExistingZip (File[] files) throws IOException
 
void streamEntryToExistingZip (InputStream in, String name) throws IOException
 
void injectZip (String injectionZip)
 
void injectZip (File injectionZip)
 
void injectZip (File injectionZip, String injectionPath)
 
File streamEntryToExistingZip (Map< String, InputStream > nameStream) throws IOException
 
void addFolderFilesToNewZip (String newZip, String toBeZipped) throws Exception
 
void addFileToZipDIr (File file) throws IOException
 
void compressZipDir (String file) throws FileNotFoundException, IOException
 
void compressZipDir () throws FileNotFoundException, IOException
 
void zipDir (String directory, ZipOutputStream zos, String path) throws IOException
 
void removeAllEntries ()
 

Detailed Description

Provides methods of accessing zip tools.

Author
Adam Outler adamo.nosp@m.utle.nosp@m.r@gma.nosp@m.il.c.nosp@m.om

Constructor & Destructor Documentation

CASUAL.archiving.Zip.Zip ( CASUALSessionData  sd,
File  zip 
) throws IOException

Constructor for the Zip class.

The File set in this is not the folder where the files to be zipped are, but instead the actual file that will be created by the zip.

Example: ./test.zip

Parameters
sdThe CASUALSessionData instace to use for this.
zipoutput file to be worked with
Exceptions
IOException
CASUAL.archiving.Zip.Zip ( CASUALSessionData  sd,
File  zip 
) throws IOException

Constructor for the Zip class.

The File set in this is not the folder where the files to be zipped are, but instead the actual file that will be created by the zip.

Example: ./test.zip

Parameters
sdThe CASUALSessionData instace to use for this.
zipoutput file to be worked with
Exceptions
IOException

Member Function Documentation

void CASUAL.archiving.Zip.addFilesToExistingZip ( String  fileToAdd) throws IOException

Streams a file directly into a zipfile.

This bypasses the uses of temp folder to stream the selected file into a zip folder by writing the ZipOutputStream from an existing zip file directly into the ZipInputStream of another.

Parameters
fileToAddfile to be added
Exceptions
IOException
void CASUAL.archiving.Zip.addFilesToExistingZip ( String  fileToAdd) throws IOException

Streams a file directly into a zipfile.

This bypasses the uses of temp folder to stream the selected file into a zip folder by writing the ZipOutputStream from an existing zip file directly into the ZipInputStream of another.

Parameters
fileToAddfile to be added
Exceptions
IOException
void CASUAL.archiving.Zip.addFilesToExistingZip ( String[]  filesToBeZipped) throws IOException

Streams files directly into a zipfile.

This bypasses the uses of temp folder to stream the selected files into a zip folder by writing the ZipOutputStream from an existing zip file directly into the ZipInputStream of another.

Parameters
filesToBeZippedfile to be added
Exceptions
IOException
See Also
ZipInputStream
ZipOutputStream
void CASUAL.archiving.Zip.addFilesToExistingZip ( String[]  filesToBeZipped) throws IOException

Streams files directly into a zipfile.

This bypasses the uses of temp folder to stream the selected files into a zip folder by writing the ZipOutputStream from an existing zip file directly into the ZipInputStream of another.

Parameters
filesToBeZippedfile to be added
Exceptions
IOException
See Also
ZipInputStream
ZipOutputStream
void CASUAL.archiving.Zip.addFilesToExistingZip ( File  fileToAdd) throws IOException

Streams a file directly into a zipfile.

This bypasses the uses of temp folder to stream the selected file into a zip folder by writing the ZipOutputStream from an existing zip file directly into the ZipInputStream of another.

Parameters
fileToAddfile to be added
Exceptions
IOException
void CASUAL.archiving.Zip.addFilesToExistingZip ( File  fileToAdd) throws IOException

Streams a file directly into a zipfile.

This bypasses the uses of temp folder to stream the selected file into a zip folder by writing the ZipOutputStream from an existing zip file directly into the ZipInputStream of another.

Parameters
fileToAddfile to be added
Exceptions
IOException
void CASUAL.archiving.Zip.addFilesToExistingZip ( File[]  files) throws IOException

Streams files directly into a zipfile.

This bypasses the uses of temp folder to stream the selected files into a zip folder by writing the ZipOutputStream from an existing zip file directly into the ZipInputStream of another.

This method is used once the File[] has been created.

Parameters
filesfiles to be zipped
Exceptions
IOException
void CASUAL.archiving.Zip.addFilesToExistingZip ( File[]  files) throws IOException

Streams files directly into a zipfile.

This bypasses the uses of temp folder to stream the selected files into a zip folder by writing the ZipOutputStream from an existing zip file directly into the ZipInputStream of another.

This method is used once the File[] has been created.

Parameters
filesfiles to be zipped
Exceptions
IOException
void CASUAL.archiving.Zip.addFileToZipDIr ( File  file) throws IOException

adds a file to a zip directory.

Parameters
filefile to add
Exceptions
IOException
void CASUAL.archiving.Zip.addFileToZipDIr ( File  file) throws IOException

adds a file to a zip directory.

Parameters
filefile to add
Exceptions
IOException
void CASUAL.archiving.Zip.addFolderFilesToNewZip ( String  newZip,
String  toBeZipped 
) throws Exception

STATIC Creates a new zip from a folder.

This method creates a new zip file from the folder that is handed in the second argument.

Parameters
newZipoutput .zip File
toBeZippedFile or folder to be placed in the Zip File.
Exceptions
Exception
void CASUAL.archiving.Zip.addFolderFilesToNewZip ( String  newZip,
String  toBeZipped 
) throws Exception

STATIC Creates a new zip from a folder.

This method creates a new zip file from the folder that is handed in the second argument.

Parameters
newZipoutput .zip File
toBeZippedFile or folder to be placed in the Zip File.
Exceptions
Exception
void CASUAL.archiving.Zip.addToTempFolderLoc ( String  TempFolder)

Changes the depth of the tempfolder.

This is used to specify a different temp folder then the tempfolder stated in CASUAL.CASUALSessionData.getInstance(). It will add a new folder within that tempfolder to be used too add all the files that must be zipped up into.

If the folder does not exist it will be created.

Parameters
TempFolderstring of name of folder to dive into
void CASUAL.archiving.Zip.addToTempFolderLoc ( String  TempFolder)

Changes the depth of the tempfolder.

This is used to specify a different temp folder then the tempfolder stated in CASUAL.CASUALSessionData.getInstance(). It will add a new folder within that tempfolder to be used too add all the files that must be zipped up into.

If the folder does not exist it will be created.

Parameters
TempFolderstring of name of folder to dive into
void CASUAL.archiving.Zip.compressZipDir ( String  file) throws FileNotFoundException, IOException

STATIC Compresses a folder into a .zip file

Parameters
filefolder to be compressed
Exceptions
FileNotFoundException
IOException
void CASUAL.archiving.Zip.compressZipDir ( String  file) throws FileNotFoundException, IOException

STATIC Compresses a folder into a .zip file

Parameters
filefolder to be compressed
Exceptions
FileNotFoundException
IOException
void CASUAL.archiving.Zip.compressZipDir ( ) throws FileNotFoundException, IOException

Compresses the TempFolder into a .zip file

Exceptions
FileNotFoundException
IOException
void CASUAL.archiving.Zip.compressZipDir ( ) throws FileNotFoundException, IOException

Compresses the TempFolder into a .zip file

Exceptions
FileNotFoundException
IOException
String CASUAL.archiving.Zip.getTempFolder ( )

Getter for the TempFolder where the files are to be transfered into before they get steamed into a zip file.

Returns
the string for the location of the TempFolder
String CASUAL.archiving.Zip.getTempFolder ( )

Getter for the TempFolder where the files are to be transfered into before they get steamed into a zip file.

Returns
the string for the location of the TempFolder
void CASUAL.archiving.Zip.injectZip ( String  injectionZip)

This merges two separate zipfiles into a single file.

Injects the zip into the root of the initial zip.

Parameters
injectionZipstring of the zipfile
void CASUAL.archiving.Zip.injectZip ( String  injectionZip)

This merges two separate zipfiles into a single file.

Injects the zip into the root of the initial zip.

Parameters
injectionZipstring of the zipfile
void CASUAL.archiving.Zip.injectZip ( File  injectionZip)

This merges two separate zipfiles into a single file.

Injects the zip into the root of the initial zip.

Parameters
injectionZipthe zip that is to be injected
void CASUAL.archiving.Zip.injectZip ( File  injectionZip)

This merges two separate zipfiles into a single file.

Injects the zip into the root of the initial zip.

Parameters
injectionZipthe zip that is to be injected
void CASUAL.archiving.Zip.injectZip ( File  injectionZip,
String  injectionPath 
)

This merges two separate zipfiles into a single file.

If the injection path is empty, the root of the injected files will be the root of the initial zip. If it is not the location will injected at the path relative to the root of the current zip

Parameters
injectionZipthe zip that is to be injected
injectionPaththe path relative to the root of the
void CASUAL.archiving.Zip.injectZip ( File  injectionZip,
String  injectionPath 
)

This merges two separate zipfiles into a single file.

If the injection path is empty, the root of the injected files will be the root of the initial zip. If it is not the location will injected at the path relative to the root of the current zip

Parameters
injectionZipthe zip that is to be injected
injectionPaththe path relative to the root of the
void CASUAL.archiving.Zip.streamEntryToExistingZip ( InputStream  in,
String  name 
) throws IOException

Streams an InputStream directly into a zipfile.

This takes an InputStream and streams it directly into a zipfile.

Parameters
inthe InputStream to be injected into the zipfile
namethe name of the File that the InputStream will create inside the zip
Exceptions
IOException
See Also
InputStream
void CASUAL.archiving.Zip.streamEntryToExistingZip ( InputStream  in,
String  name 
) throws IOException

Streams an InputStream directly into a zipfile.

This takes an InputStream and streams it directly into a zipfile.

Parameters
inthe InputStream to be injected into the zipfile
namethe name of the File that the InputStream will create inside the zip
Exceptions
IOException
See Also
InputStream
File CASUAL.archiving.Zip.streamEntryToExistingZip ( Map< String, InputStream >  nameStream) throws IOException

Streams multiple InputStream directly into a zipfile.

This takes an a keyed pair of String names, and InputStreams and streams them directly into a zipfile.

Parameters
nameStreammap that contains keys that are Strings, and values that are InputStream
Returns
zip file
Exceptions
IOException
See Also
Map
InputStream
File CASUAL.archiving.Zip.streamEntryToExistingZip ( Map< String, InputStream >  nameStream) throws IOException

Streams multiple InputStream directly into a zipfile.

This takes an a keyed pair of String names, and InputStreams and streams them directly into a zipfile.

Parameters
nameStreammap that contains keys that are Strings, and values that are InputStream
Returns
zip file
Exceptions
IOException
See Also
Map
InputStream
void CASUAL.archiving.Zip.zipDir ( String  directory,
ZipOutputStream  zos,
String  path 
) throws IOException

Zip up a directory path

Parameters
directorydirectory to zip
zosoutputstream to output into
pathpath inside zip
Exceptions
IOException
void CASUAL.archiving.Zip.zipDir ( String  directory,
ZipOutputStream  zos,
String  path 
) throws IOException

Zip up a directory path

Parameters
directorydirectory to zip
zosoutputstream to output into
pathpath inside zip
Exceptions
IOException

The documentation for this class was generated from the following file: