mn8 Language Reference | Index    

Zip

SUMMARY: NO ATTRIBUTES  NO ELEMENTS  CONSTRUCTORS SUMMARY  NO OPERATORS  METHODS SUMMARYDETAIL: NO ATTRIBUTES  NO ELEMENTS  CONSTRUCTOR DETAILS  NO OPERATORS  METHOD DETAILS

Description

This concept allow to read and write the standard ZIP file.
This concept allow to add, remove, extract and view files form ZIP archive.

Usage

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")
        

Version: 0.1
Authors:Szabo Csaba
Inherits: Concept

Constructor List

create (String $path)
top

Method List

add (String $path)
add (String $content, String $path)
Seriesdelete (String $path)
extract (String $dir, String $path)
extractAll (String $dir)
Serieslist
Stringview (String $path)
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getConceptsAtPath, getErrorHandler, getInheritedConcepts, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML

Detailed Constructor Info

create (String $path)
Parameters:
$path : The path to the location where the file will be created with the archive name.
Exceptions:
openZipFailed :
(Error)
If unable to open the zip file.

Creates a new tar archive file with the specified path.

top

Detailed Method Info

add (String $path)
Parameters:
$path :The path to the file which will be added.
Exceptions:
pathNotFound :
(Error)
If the path not found.
addtoZipFailed :
(Warning)
If can not add the file to zip archive.
openZipFailed :
(Error)
If can not open the zip archive..

Adds the specified file to this archive.

top
add (String $content, String $path)
Parameters:
$content :The content of the file specified in the $path.
$path :The path to the file in the archive.
Exceptions:
addtoZipFailed :
(Warning)
If can not add the file to zip archive.
openZipFailed :
(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.

top
delete (String $path)
Parameters:
$path :The path to the file in this archive which will be deleted.
Returns: Series
Exceptions:
openZipFailed :
(Error)
If can not open the zip archive.
removeFailed :
(Error)
If can not remove entry form zip archive.

Deletes the specified file from this archive.

top
extract (String $dir, String $path)
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:
readFailed :
(Error)
If can not read the zip archive.

Extracts the specified file from this archive in the given directory.

top
extractAll (String $dir)
Parameters:
$dir : The path to the directory in which will be extracted this archive.
Exceptions:
readFailed :
(Error)
If can not read the zip archive.

Extracts all files from this archive in the specified directory.

top
list
Returns: Series

Returns a series which contains all files name in this archive.

top
view (String $path)
Parameters:
$path :The path in this archive to the file.
Returns: String
Exceptions:
pathNotFound :
(Error)
If the specified path not found in zip archive.
readFailed :
(Error)
If unable to read zip archive.

Returns the file content specified by the $path.

top