This concept allow to read and write the standard ZIP file.
This concept allow to add, remove, extract and view files form ZIP archive.
List files form specified ZIP archive.
$zFile = Zip.create( "ZipName" )
print $zFile.list
Add files and string to ZIP archive.
$zFile = Zip.create("ZipName")
$zFile.add("filePath")
$zFile.add("text", "asPath")
View contents of files form ZIP archive.
$zFile = Zip.create("ZipName")
each $file in $zFile.list do [
print $file
print "-------------------------------------------------------------"
print $zFile.view( $file )
print "-------------------------------------------------------------"]
Extract all files in specified directory form ZIP archive.
$zFile = Zip.create("ZipName")
$zFile.extractAll("dirName")
Methods inherited from: Concept
| cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
| Parameters: |
| $path : |
The path to the location where the file will be created with the archive name. |
|
| Exceptions: |
IOException :
(Error) | If unable to open the zip file. |
Creates a new tar archive file with the specified path.
| Parameters: |
| $path : | The path to the file which will be added. |
|
| Exceptions: |
pathNotFoundException :
(Error) | If the path not found. |
addtoZipFailed :
(Warning) | If can not add the file to zip archive. |
IOException :
(Error) | If can not open the zip archive. |
Adds the specified file to this archive.
$zFile = Zip.create( "test.zip" )
$zFile.add( "/devel/spacemapper/mn8/src/main/org/media/naming/" )
print $zFile.list
-- the result is --
/devel/spacemapper/mn8/src/main/org/media/naming/MemoryContextTest.java
/devel/spacemapper/mn8/src/main/org/media/naming/MemoryContextFactory.java
/devel/spacemapper/mn8/src/main/org/media/naming/CVS/Repository
/devel/spacemapper/mn8/src/main/org/media/naming/package.html
/devel/spacemapper/mn8/src/main/org/media/naming/ReferenceRefAddr.java
/devel/spacemapper/mn8/src/main/org/media/naming/CVS/Entries
/devel/spacemapper/mn8/src/main/org/media/naming/MemoryBinding.java
/devel/spacemapper/mn8/src/main/org/media/naming/MemoryContext.java
/devel/spacemapper/mn8/src/main/org/media/naming/CVS/Root
| Parameters: |
| $content : | The content of the file specified in the $path. |
| $path : | The path to the file in the archive. |
|
| Exceptions: |
entryExistsException :
(Warning) | If can not add the file to zip archive. |
IOException :
(Error) | If can not open the zip archive. |
Adds a new file to this archive with the name specified in the $path and
with the given $content.
$zFile = Zip.create( "test.zip" )
$zFile.add("This is a test", "text.txt")
$zFile.add("This is another test", "text1.txt")
print $zFile.list
-- the result is --
text.txt
text1.txt
| Parameters: |
| $path : | The path to the file in this archive which will be deleted. |
|
| Exceptions: |
pathNotFoundException :
(Error) | If can not open the zip archive. |
IOException :
(Error) | If can not remove entry form zip archive. |
Deletes the specified file from this archive.
$zFile = Zip.create( "test.zip" )
$zFile.add("This is a test", "text.txt")
$zFile.add("This is another test", "text1.txt")
$zFile.delete("text1.txt")
print $zFile.list
-- the result is --
text.txt
| Parameters: |
| $dir : |
The path to the directory in which will be extracted the specified file. |
| $path : |
The path to the file in this archive which will be extracted. |
|
| Exceptions: |
pathNotFoundException :
(Error) | If can not open the zip archive. |
IOException :
(Error) | If can not read the zip archive. |
Extracts the specified file from this archive in the given directory.
$zFile = Zip.create( "test.zip" )
$zFile.add("This is a test", "text.txt")
$zFile.add("This is another test", "text1.txt")
print $zFile.extract("/temp/", "text.txt")
-- the result is --
Extract 'text.txt' file from archive.
| Parameters: |
| $dir : |
The path to the directory in which will be extracted this archive. |
|
| Exceptions: |
pathNotFoundException :
(Error) | If can not open the zip archive. |
IOException :
(Error) | If can not read the zip archive. |
Extracts all files from this archive in the specified directory.
$zFile = Zip.create( "test.zip" )
$zFile.add("This is a test", "text.txt")
$zFile.add("This is another test", "text1.txt")
print $zFile.extractAll("/temp/")
-- the result is --
Extract all files from archive.
Returns a series which contains all files name in this archive.
$zFile = Zip.create( "test.zip" )
$zFile.add("This is a test", "text.txt")
$zFile.add("This is another test", "text1.txt")
print $zFile.list
-- the result is --
text.txt
text1.txt
| Parameters: |
| $path : | The path in this archive to the file. |
|
| Exceptions: |
pathNotFoundException :
(Error) | If the specified path not found in zip archive. |
IOException :
(Error) | If unable to read zip archive. |
Returns the file content specified by the $path.
$zFile = Zip.create( "test.zip" )
$zFile.add("This is a test", "text.txt")
$zFile.add("This is another test", "text1.txt")
print $zFile.wiew("text.txt")
-- the result is --
This is a test