User Tools

Site Tools


DzZipFile

DAZ Script *.zip (zlib) file I/O class.

More...

Inherits :

Enumerations

Constructors

DAZ Script
DzZipFile ( String file )

Methods

Detailed Description

Provides functionality for reading and writing zlib compressed *.zip files.

Enumerations


: AccessMode

Enumerated values used with open() to describe the mode in which a file is opened.

  • ReadOnly - Open the file for reading only.
  • WriteOnly - Open the file for writing only.
  • Append - The file is opened in append mode, so that all data is written to the end of the file.

Constructors


DzZipFile( String file )

Creates a zip file with the given file name.

Parameter(s):

  • file - The path of the *.zip file.

Methods


Boolean : addDirToZip( String pathOnDisk, String pathInZip )

Compresses all the files in the given directory.

Parameter(s):

  • pathOnDisk - The path of the directory that contains the directory to compress.
  • pathInZip - The path of the directory to compress to within the zip.

Since:

  • 4.9.3.149

Boolean : addFileToZip( String pathOnDisk, String pathInZip )

Compresses the file into the zip.

Parameter(s):

  • pathOnDisk - The path of the directory that contains the file to compress.
  • pathInZip - The path of the file to compress to within the zip.

Since:

  • 4.9.3.149

void : close()

Close the file.


Boolean : compressAll( String path, Boolean recursive=true )

Compresses all the files in the given directory.

Parameter(s):

  • path - The path to the directory to compress files from.
  • recursive - If true, path represents the base path of the directory tree to compress (i.e., the contents of the directory, all subdirectories, and the contents of those directories, recursively). If false, only files in the given path are compressed.

Boolean : extractAll( String basePath )

Extracts all the files from the zip file. The relative path of the files are appended to the specified base path.

Parameter(s):

  • basePath - The base path to extract the files to.

Boolean : extractCurrentFile( String basePath )

Extracts the current file from the zip file. The relative path of the current file is appended to the specified base path.

Parameter(s):

  • basePath - The base path to extract to.

Since:

  • 4.9.3.149

Number : getCurrentFileAtributes()

Return Value:

  • The number of the entry in the current file (if any).

Since:

  • 4.9.3.149

String : getCurrentFileComment()

Return Value:

  • The comment for the current file (if any).

Number : getCurrentFileCompressedSize()

Return Value:

  • The compressed size of the current file.

Since:

  • 4.9.3.149

String : getCurrentFileCompressionMethod()

Return Value:

  • The compression method of the current file.

Since:

  • 4.9.3.149

Number : getCurrentFileCompressionRatio()

Return Value:

  • The ratio of compression on the current file.

Since:

  • 4.9.3.149

String : getCurrentFileCRC()

Return Value:

  • The CRC value of the current file.

Since:

  • 4.9.3.149

Boolean : getCurrentFileIsFolder()

Return Value:

  • true if the current entry is a folder, otherwise false.

Since:

  • 4.9.3.149

String : getCurrentFileName()

Return Value:

  • The name of the current file.

Number : getCurrentFileUncompressedSize()

Return Value:

  • The compressed size of the current file.

Since:

  • 4.9.3.149

Array : getFileNames()

Return Value:

  • A list of the file names in the zip file.

String : getGlobalComment()

Return Value:

  • The global comment for the zip file.

Number : getNumEntries()

Return Value:

  • The number of entries in the zip file.

Boolean : goToFirstFile()

Set the current file of the zip file to the first file.


Boolean : goToNextFile()

Set the current file of the zip file to the next file.


Boolean : locateFile( String pathInZip )

Attempts to locate an entry in the zip file.

Parameter(s):

  • pathInZip - The path of the entry to locate within the zip.

Return Value:

  • true if the file was found, otherwise false.

Attention:

  • If the entry is found, it becomes the current.

Boolean : open( AccessMode mode )

Open the file with the given mode.

Return Value:

  • true if the file was opened successfully, otherwise false.

Boolean : setGlobalComment( String comment )

The global comment for the zip file.

Return Value:

  • true if the comment was set, otherwise false.

Since:

  • 4.9.3.149