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 )

Creates a directory entry within this zip.

Parameter(s):

  • pathOnDisk - The absolute path of the source directory.
  • pathInZip - The relative path for the directory within this zip - this value should not start with a slash, but should end with one.

Return Value:

  • true if this zip file is open for writing and the operation was successful, otherwise false.

Since:

  • 4.9.3.149

Boolean : addFileToZip( String pathOnDisk, String pathInZip )

Compresses the specified file into this zip.

Parameter(s):

  • pathOnDisk - The absolute path of the file to compress.
  • pathInZip - The relative path for the file within this zip - this value should not start with a slash.

Return Value:

  • true if this zip file is open for writing and the operation was successful, otherwise false.

Since:

  • 4.9.3.149

void : close()

Closes this zip file.


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

Compresses all of the files in the specified directory into this zip.

Parameter(s):

  • path - The absolute base path of the directory to compress.
  • recursive - If true (default), the entire hierarchy of folders and files within path are compressed. If false, only the files in the specified path are compressed.

Return Value:

  • true if this zip file is open for writing and the operation was successful, otherwise false.

Boolean : extractAll( String basePath )

Extracts all of the files from this 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.

Return Value:

  • true if this zip file is open for reading and the operation was successful, otherwise false.

Boolean : extractCurrentFile( String basePath )

Extracts the current file from this 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.

Return Value:

  • true if this zip file is open for reading and the operation was successful, otherwise false.

See Also:

Since:

  • 4.9.3.149

Number : getCurrentFileAttributes()

Return Value:

  • The external file attributes of the current file if this zip file is open for reading, otherwise 0.

See Also:

Since:

  • 4.16.1.25

String : getCurrentFileComment()

Return Value:

  • The comment for the current file if this zip file is open for reading, otherwise an empty string.

See Also:


Number : getCurrentFileCompressedSize()

Return Value:

  • The compressed size of the current file if this zip file is open for reading, otherwise 0.

See Also:

Since:

  • 4.9.3.149

String : getCurrentFileCompressionMethod()

Return Value:

  • The compression method of the current file if this zip file is open for reading, otherwise an empty string.

See Also:

Since:

  • 4.9.3.149

Number : getCurrentFileCompressionRatio()

Return Value:

  • The ratio of compression on the current file if this zip file is open for reading, otherwise -1.

See Also:

Since:

  • 4.9.3.149

String : getCurrentFileCRC()

Return Value:

  • The CRC value of the current file if this zip file is open for reading otherwise an empty string.

See Also:

Since:

  • 4.9.3.149

Date : getCurrentFileDateTime()

Return Value:

  • The timestamp of the current file if this zip file is open for reading otherwise an invalid Date.

See Also:

Since:

  • 4.16.1.25

Boolean : getCurrentFileIsFolder()

Return Value:

  • true if this zip file is open for reading and the current entry is a folder, otherwise false.

See Also:

Since:

  • 4.9.3.149

String : getCurrentFileName()

Return Value:

  • The name of the current file if this zip file is open for reading, otherwise an empty string.

See Also:


Number : getCurrentFileUncompressedSize()

Return Value:

  • The compressed size of the current file if this zip file is open for reading, otherwise 0.

See Also:

Since:

  • 4.9.3.149

Array : getFileNames()

Return Value:

  • A list of the file names in this zip file if this zip file is open for reading, otherwise an empty list.

String : getGlobalComment()

Return Value:

  • The global comment for this zip file (if any), otherwise an empty string.

Number : getNumEntries()

Return Value:

  • The number of entries in this zip file if this zip file is open, otherwise 0.

See Also:


Boolean : goToFirstFile()

Sets the current file of this zip file to the first file.

Return Value:

  • true if this zip file is open for reading and the operation was successful, otherwise false.

See Also:


Boolean : goToNextFile()

Sets the current file of this zip file to the next file.

Return Value:

  • true if this zip file is open for reading and the operation was successful, otherwise false.

See Also:


Boolean : locateFile( String pathInZip )

Attempts to locate an entry within this zip file.

Parameter(s):

  • pathInZip - The relative path of the entry to locate - this value should not start with a slash.

Return Value:

  • true if this zip file is open for reading and the file was found, otherwise false.

Attention:

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

See Also:


Boolean : open( AccessMode mode )

Opens this zip file in the specified mode.

Parameter(s):

  • mode - The access mode to open with.

Return Value:

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

Boolean : setGlobalComment( String comment )

Sets the global comment for this zip file.

Parameter(s):

  • comment - The comment to set.

Return Value:

  • true if this zip file is open for writing and the comment was set, otherwise false.

Since:

  • 4.9.3.149

Number : getCurrentFileAtributes()

Deprecated

Exists only to keep old code working. Do not use in new code. Use getCurrentFileAttributes() instead.

Since:

  • 4.9.3.149