Zelix KlassMaster - Documentation
 

The saveAll Statement

The ZKM Script saveAll statement saves all opened classes to the specified directory.

The remainder of this page is organized into the following sections.

Explanation

The saveAll statement saves all opened classes in their current state. If the statement follows an obfuscate statement then the classes will be saved in their obfuscated state. If a directory specified by the saveAll statement doesn't exist then it will be created. If saveAll is going to overwrite an already existing archive file then it will first rename the existing file by appending the suffix ".BACKUP" to the end of its name.

Any directory specified in a saveAll statement may be absolute or relative. If a specified directory is relative then it will be relative to
  • Any directory specified in the "defaultDirectoryName" command line option
  • Otherwise, it will be relative to the working directory.

The archiveCompression parameter allows you to determine the compression of any archive files created by the saveAll statement. By default, the saveAll statement acts as if the value of archiveCompression is asIs. The meaning of the different values of archiveCompression are listed below.
archiveCompression Effect
 all All archive entries will be compressed.
 none No archive entries will be compressed.
 asIs If an entry in the original archive was compressed then the corresponding entry in the new archive will be compressed. If an entry in the original archive was not compressed then the corresponding entry in the new archive will not be compressed.

You can optionally specify deleteEmptyDirectories=true to prevent empty directories from being written to the obfuscated archive file.

The optional deleteXMLComments parameter allows you to specify that all comments in any XML files saved by the saveAll statement should be deleted. The allowable values are deleteXMLComments=false (which is the default) and deleteXMLComments=true.

The optional lastModifiedTime parameter allows you to specify the last modified date to be used when saving the obfuscated output to an archive file. This parameter is intended to be used when you have specified reproducible obfuscate output. Otherwise the saved archive file will not be identical across build because of the changing last modified dates.

Typically you would specify a directory into which all opened files will be saved. However, you may also specfy specific paths into which specific opened files will be saved. Zelix KlassMaster™ will match the specific save path to an opened file by matching its unqualified file name with that of the the opened file. So, if the save path "\saveDirectory\Jar0.jar" is specified in a saveAll statement, then Zelix KlassMaster™ will look for an archive named "Jar0.jar" in the preceding open statement.

The saveAll statement performs a good deal of special handling of
  • class files opened from jar and zip archives,
  • non-class files such as image and properties files opened from jar and zip archives,
  • manifest, EJB deployment descriptor and service provider files.
See the File|SaveAll menu option documentation for more detail.

Examples

saveAll "c:\temp";   //Defaults to archiveCompression=asIs. All opened files saved into C:\Temp.

//All opened files saved into "myRelativeDirectory" directory which is relative to working directory.
saveAll archiveCompression=all "myRelativeDirectory";

//All opened files saved into "myRelativeDirectory" directory and all comments in any XML files will be deleted.
saveAll deleteXMLComments=true "myRelativeDirectory";

saveAll "\Projects" //By default, opened files will be saved into \Projects
        "\Projects\lib\Lib0.jar" //Lib0.jar will be saved into \Projects\lib
        "lib\Config.xml" //Config.xml will be saved into the relative directory lib
        ;

Syntax

"saveAll" ["archiveCompression" "=" ("all" | "none" | "asIs")]
["deleteEmptyDirectories" "=" ("true" | "false")]
["deleteXMLComments" "=" ("true" | "false")]
["lastModifiedTime" "=" ("\"" ISO-8601_date "\"" | "\"" longDate "\"" )]
"\"" defaultDirectoryName "\""
("\"" specificPath "\"")*
";"

where
  • defaultDirectoryName is the name of the directory into which the class, archive, JAD or XML files are to be saved,
  • specificPath is the specific save path for a particular archive, JAD or XML file. The specific save path must end with the name of an archive, JAD or XML file which appears in the preceding open statement.
  • ISO-8601_date is a date in ISO-8601 format. E.g. "2021-12-03T10:15:30Z".
  • longDate is a date expressed as the number of milliseconds since January 1, 1970 UTC. E.g. "978310861010".
You can embed quotes within the directory name by using two consecutive quotes (ie. "") for each quote to be embedded.

ZKM Script obfuscate statement The ZKM Script Language ZKM Script gc statement
Zelix KlassMaster - Java Obfuscator