mura

Class Zip

lucee.Component
    extended by mura.cfobject
      extended by mura.Zip

This provides a collections of functions that supports the Zip and GZip functionality by using the Java Zip file API.

Class Attributes:
  • output : false
  •  
  • displayname : Zip Component
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
    Method Summary
    boolean AddFiles(string zipFilePath, [string files], [string directory], [string filter=''], [boolean recurse='false'], [numeric compression='9'], [boolean savePaths='false'], [string sinceDate=''], [boolean hiddenFiles='false'], string excludeDirs='')
         Add files to a new or an existing Zip file archive.
    boolean DeleteFiles(string zipFilePath, string files)
         Delete files from an existing Zip file archive.
    boolean Extract(string zipFilePath, [string extractPath='[runtime expression]'], [string extractFiles], [boolean useFolderNames='true'], [boolean overwriteFiles='false'], [string extractDirs], [string excludeDirs], [string extractDirsToTop])
         Extracts a specified Zip file into a specified directory.
    private array FilesList(string directory, [string filter=''], [boolean recurse='false'], [string sinceDate=''], [boolean hiddenFiles='false'], string excludeDirs='')
         Create an array with the file names of specified directory.
    boolean gzipAddFile(string gzipFilePath, string filePath)
         Create a new GZip file archive.
    boolean gzipExtract(string gzipFilePath, [string extractPath='[runtime expression]'])
         Extracts a specified GZip file into a specified directory.
    any List(string zipFilePath)
         List the content of a specified Zip file.
    private any PathFormat(string path)
         Convert path into Windows or Unix format.
    private any ZipPathFormat(string path)
         Convert path into Windows or Unix format.
     
    Methods inherited from class mura.cfobject
    commitTracePoint, convertTimezone, deleteMethod, get, getAsJSON, getAsStruct, getBean, getConfigBean, getCurrentUser, getEventManager, getFeed, getHTTPAttrs, getHTTPService, getJavaTimezone, getPlugin, getPluginManager, getQueryAttrs, getQueryService, getServiceFactory, getSession, getValue, hasCustomDatasource, init, initTracePoint, inject, injectMethod, invokeMethod, mixin, parseDateArg, removeValue, set, setValue, valueExists
     
    Methods inherited from class lucee.Component
    None

    Method Detail

    AddFiles

    public boolean AddFiles(string zipFilePath, [string files], [string directory], [string filter=''], [boolean recurse='false'], [numeric compression='9'], [boolean savePaths='false'], [string sinceDate=''], [boolean hiddenFiles='false'], string excludeDirs='')

    Add files to a new or an existing Zip file archive.

    Parameters:
    zipFilePath - Pathname of the Zip file to add files.
    files - | (Chr(124)) delimited list of files to add to the Zip file. Required if argument 'directory' is not set.
    directory - Absolute pathname of directory to add to the Zip file. Required if argument 'files' is not set.
    filter - File extension filter. One filter can be applied. Only if argument 'directory' is set.
    recurse - Get recursive files of subdirectories. Only if argument 'directory' is set.
    compression - Compression level (0 through 9, 0=minimum, 9=maximum).
    savePaths - Save full path info.
    sinceDate - Filter for files created since this datetime
    hiddenFiles - Whether to include .svn or .git files.
    excludeDirs - | (Chr(124)) delimited list of dirs to not zip.

    DeleteFiles

    public boolean DeleteFiles(string zipFilePath, string files)

    Delete files from an existing Zip file archive.

    Parameters:
    zipFilePath - Pathname of the Zip file to delete files from.
    files - | (Chr(124)) delimited list of files to delete from Zip file.

    Extract

    public boolean Extract(string zipFilePath, [string extractPath='[runtime expression]'], [string extractFiles], [boolean useFolderNames='true'], [boolean overwriteFiles='false'], [string extractDirs], [string excludeDirs], [string extractDirsToTop])

    Extracts a specified Zip file into a specified directory.

    Parameters:
    zipFilePath - Pathname of the Zip file to extract.
    extractPath - Pathname to extract the Zip file to.
    extractFiles - | (Chr(124)) delimited list of files to extract.
    useFolderNames - Create folders using the pathinfo stored in the Zip file.
    overwriteFiles - Overwrite existing files.
    extractDirs - | (Chr(124)) delimited list of dirs to extract.
    excludeDirs - | (Chr(124)) delimited list of dirs to not extract.
    extractDirsToTop

    FilesList

    private array FilesList(string directory, [string filter=''], [boolean recurse='false'], [string sinceDate=''], [boolean hiddenFiles='false'], string excludeDirs='')

    Create an array with the file names of specified directory.

    Parameters:
    directory - Absolute pathname of directory to get files list.
    filter - File extension filter. One filter can be applied.
    recurse - Get recursive files of subdirectories.
    sinceDate - Filter for files created since this datetime
    hiddenFiles - Whether to include .svn or .git files.
    excludeDirs - | (Chr(124)) delimited list of dirs to not zip.

    gzipAddFile

    public boolean gzipAddFile(string gzipFilePath, string filePath)

    Create a new GZip file archive.

    Parameters:
    gzipFilePath - Pathname of the GZip file to create.
    filePath - Pathname of a file to add to the GZip file archive.

    gzipExtract

    public boolean gzipExtract(string gzipFilePath, [string extractPath='[runtime expression]'])

    Extracts a specified GZip file into a specified directory.

    Parameters:
    gzipFilePath - Pathname of the GZip file to extract.
    extractPath - Pathname to extract the GZip file to.

    List

    public any List(string zipFilePath)

    List the content of a specified Zip file.

    Parameters:
    zipFilePath - Pathname of the Zip file to list the content.

    PathFormat

    private any PathFormat(string path)

    Convert path into Windows or Unix format.

    Parameters:
    path - The path to convert.

    ZipPathFormat

    private any ZipPathFormat(string path)

    Convert path into Windows or Unix format.

    Parameters:
    path - The path to convert.