We recreated a corrupt ZIP file by archiving an old collection of wallpapers and deleting parts of the file's code using a hex editor.In doing so, our collection dropped from nine images to one. The MSL code is needed for access to various hidden system configuration menus (e.g. The one accessed via dialing ##33284# on a Samsung Transform Ultra). Get My MSL will give you your MSL code without the need to use adb shell or have a terminal app installed.
Zip
Description
Getspc Zip File
Creates a zipfile.
The basedir attribute is the reference directory from where to zip.
Note that file permissions will not be stored in the resulting zipfile.
It is possible to refine the set of files that are being zipped. This can be done withthe includes, includesfile, excludes, excludesfileand defaultexcludes attributes. With the includes or includesfileattribute you specify the files you want to have included by using patterns. The excludeor excludesfile attribute is used to specify the files you want to have excluded. This isalso done with patterns. And finally with the defaultexcludes attribute, you can specifywhether you want to use default exclusions or not. See the sectionon directory based tasks, on how theinclusion/exclusion of files works, and how to write patterns.
This task forms an implicit FileSet and supports mostattributes of <fileset>
(dir becomes basedir) as well asthe nested <include>
, <exclude>
and <patternset>
elements.
Or, you may place within it nested file sets, or references to file sets. In thiscase basedir is optional; the implicit file set is only usedif basedir is set. You may use any mixture of the implicit file set(with basedir set, and optional attributes like includes and optionalsubelements like <include>
); explicit nested <fileset>
elements so long as at least one fileset total is specified. The ZIP file will only reflect therelative paths of files within each fileset. The Zip task and its derivatives know aspecial form of a fileset named zipfileset
that has additional attributes (describedbelow).
The Zip task also supports the merging of multiple zip files into the zip file. This is possiblethrough either the src attribute of any nested filesets or by using the special nestedfileset zipgroupfileset
.
The update parameter controls what happens if the ZIP file already exists. When setto yes
, the ZIP file is updated with the files specified. (New files are added; old files arereplaced with the new versions.) When set to no
(the default) the ZIP file is overwritten ifany of the files that would be added to the archive are newer than the entries inside the archive.Please note that ZIP files store file modification times with a granularity of 2 seconds. If a fileis less than 2 seconds newer than the entry in the archive, Apache Ant will not consider itnewer.
The whenempty parameter controls what happens when no files match. If skip
(the default), the ZIP is not created and a warning is issued. If fail
, the ZIP is notcreated and the build is halted with an error. If create
, an empty ZIP file (explicitly zeroentries) is created, which should be recognized as such by compliant ZIP manipulation tools.
This task will now use default JVM character encoding for filenames—this is consistent withthe command line ZIP tools, but causes problems if you try to open them from within Java and yourfilenames contain non US-ASCII characters. Use the encoding attribute and set itto UTF8
to create zip files that can safely be read by Java. For a more complete discussion,see below
Since Ant 1.5.2, <zip>
can store Unix permissions inside the archive(see description of the filemode and dirmode attributesfor <zipfileset>). Unfortunately there is no portableway to store these permissions. Ant uses the algorithm used by Info-Zip's implementation of the zip and unzipcommands—these are the default versions of zip and unzip for manyUnix(-like) systems.
Please note that the zip format allows multiple files of the same fully-qualified name toexist within a single archive. This has been documented as causing various problems forunsuspecting users. If you wish to avoid this behavior you must set the duplicateattribute to a value other than its default, add
.
Please also note that different ZIP tools handle timestamps differently when itcomes to applying timezone offset calculations of files. Some ZIP libraries will store thetimestamps as they've been read from the filesystem while others will modify the timestamps bothwhen reading and writing the files to make all timestamps use the same timezone. A ZIP archivecreated by one library may extract files with 'wrong timestamps' when extracted by anotherlibrary.
Ant's ZIP classes use the same algorithm as the InfoZIP tools and zlib (timestamps get adjusted),Windows' 'compressed folders' function and WinZIP don't change the timestamps. This means thatusing the unzip
task on files created by Windows' compressed folders function maycreate files with timestamps that are 'wrong', the same is true if you use Windows' functions toextract an Ant generated ZIP archive.
Getspc Zip File Download
Parameters
Attribute | Description | Required |
---|---|---|
destfile | the zip file to create. | Exactly one of the two |
zipfile | deprecated old name of destfile. | |
basedir | the directory from which to zip the files. | No |
compress | Not only store data but also compress them. Unless you set the keepcompression attribute to false, this will apply to the entire archive, not only the files you've added while updating. | No; defaults to true |
keepcompression | For entries coming from existing archives (like nested zipfileset s or while updating the archive), keep the compression as it has been originally instead of using the compress attribute. Since Ant 1.6 | No; defaults to false |
encoding | The character encoding to use for filenames inside the zip file. For a list of possible values see the Supported Encodings. | No; defaults to default JVM character encoding |
filesonly | Store only file entries. | No; defaults to false |
includes | comma- or space-separated list of patterns of files that must be included. | No; defaults to all (**) |
includesfile | name of a file. Each line of this file is taken to be an include pattern. | No |
excludes | comma- or space-separated list of patterns of files that must be excluded. | No; defaults to default excludes or none if defaultexcludes is no |
excludesfile | name of a file. Each line of this file is taken to be an exclude pattern. | No |
defaultexcludes | indicates whether default excludes should be used or not (yes|no). | No; defaults to yes |
update | indicates whether to update or overwrite the destination file if it already exists. | No; default is false |
whenempty | behavior when no files match. Valid values are fail, skip, and create. | No; default is skip |
duplicate | behavior when a duplicate file is found. Valid values are add, preserve, and fail. | No; default is add |
roundup | Whether the file modification times will be rounded up to the next even number of seconds. Zip archives store file modification times with a granularity of 2 seconds, so the times will either be rounded up or down. If you round down, the archive will always seem out-of-date when you rerun the task, so the default is to round up. Rounding up may lead to a different type of problems like JSPs inside a web archive that seem to be slightly more recent than precompiled pages, rendering precompilation useless. Since Ant 1.6.2 | No; defaults to true |
comment | Comment to store in the archive. Since Ant 1.6.3 | No |
level | Non-default level at which file compression should be performed. Valid values range from 0(no compression/fastest) to 9(maximum compression/slowest). Since Ant 1.7 | No |
preserve0permissions | when updating an archive or adding entries from a different archive Ant will assume that a Unix permissions value of 0 (nobody is allowed to do anything to the file/directory) means that the permissions haven't been stored at all rather than real permissions and will instead apply its own default values. Set this attribute to trueif you really want to preserve the original permission field. Since Ant 1.8.0 | No; default is false |
useLanguageEncodingFlag | Whether to set the language encoding flag if the encoding is UTF-8. This setting doesn't have any effect if the encoding is not UTF-8. Since Ant 1.8.0. See also the discussion below | No; default is true |
createUnicodeExtraFields | Whether to create Unicode extra fields to store the file names a second time inside the entry's metadata. Possible values are never, alwaysand not-encodeablewhich will only add Unicode extra fields if the file name cannot be encoded using the specified encoding. Since Ant 1.8.0. See also the discussion below | No; default is never |
fallbacktoUTF8 | Whether to use UTF-8 and the language encoding flag instead of the specified encoding if a file name cannot be encoded using the specified encoding. Since Ant 1.8.0. See also the discussion below | No; default is false |
zip64Mode | When to use Zip64 extensions for entries. The possible values are never, alwaysand as-needed. Since Ant 1.9.1. See also the discussion below | No; default is as-needed |
Encoding of file names
Traditionally the ZIP archive format uses CodePage 437 as encoding for file name, which is notsufficient for many international character sets.
Over time different archivers have chosen different ways to work around thelimitation—the java.util.zip
packages simply uses UTF-8 as itsencoding for example.
Ant has been offering the encoding
attribute of the zip
and unzip
task as a way to explicitly specify the encoding to use (or expect) sinceAnt 1.4. It defaults to default JVM character encoding for zip
and UTF-8for jar
and other jar-like tasks (war
, ear
, ...) as well asthe unzip
family of tasks.
More recent versions of the ZIP specification introduce something called the language encodingflag
which can be used to signal that a file name has been encoded using UTF-8. Since Ant1.8.0, all zip, jar and similar archives written by Ant will set this flag, if the encoding hasbeen set to UTF-8. Our interoperability tests with existing archivers didn't show any ill effects(in fact, most archivers ignore the flag to date), but you can turn off the language encodingflag
by setting the attribute useLanguageEncodingFlag to false
onthe zip
task if you should encounter problems.
The unzip
task (and similar tasks) will recognize the language encoding flag andignore the encoding set on the task if it has been found.
The InfoZIP developers have introduced new ZIP extra fields that can be used to add an additionalUTF-8 encoded file name to the entry's metadata. Most archivers ignore these extrafields. Since Ant 1.8.0, the zip
family of tasks support anoption createUnicodeExtraFields, which makes Ant write these extra fields either for allentries (always
) or only those whose name cannot be encoded using the specified encoding(not-encodeable
), it defaults to never
since the extra fields create biggerarchives.
The fallbackToUTF8 attribute of zip
can be used to create archives thatuse the specified encoding in the majority of cases but UTF-8 and the language encoding flag forfilenames that cannot be encoded using the specified encoding.
The unzip
task will recognize the Unicode extra fields by default and read the filename information from them, unless you set the optionalattribute scanForUnicodeExtraFields to false
.
Recommendations for interoperability
The optimal setting of flags depends on the archivers you expect as consumers/producers of theZIP archives. Below are some test results which may be superseded with later versions of eachtool.
- The
java.util.zip
package used by the jar executable or to read jars from yourCLASSPATH
reads and writes UTF-8 names, it doesn't set or recognize any flags or unicode extra fields. - Since Java 7,
java.util.zip
writes UTF-8 by default and uses the language encoding flag. It is possible to specify a different encoding when reading/writing ZIPs via new constructors. The package now recognizes the language encoding flag when reading and ignores the Unicode extra fields. - 7Zip writes CodePage 437 by default but uses UTF-8 and the language encoding flag when writing entries that cannot be encoded as CodePage 437 (similar to the
zip
task with fallbacktoUTF8 set totrue
). It recognizes the language encoding flag when reading and ignores the Unicode extra fields. - WinZIP writes CodePage 437 and uses Unicode extra fields by default. It recognizes the Unicode extra field and the language encoding flag when reading.
- Windows' 'compressed folder' feature doesn't recognize any flag or extra field and creates archives using the default platform encoding—and expects archives to be in that encoding when reading them.
- InfoZIP based tools can recognize and write both, it is a compile time option and depends on the platform so your mileage may vary.
- PKWARE zip tools recognize both and prefer the language encoding flag. They create archives using CodePage 437 if possible and UTF-8 plus the language encoding flag for file names that cannot be encoded as CodePage 437.
So, what to do?
If you are creating jars, then java.util.zip
is your main consumer. Werecommend you set the encoding to UTF-8 and keep the language encoding flag enabled. The flag won'thelp or hurt java.util.zip
prior to Java 7 but archivers that support itwill show the correct file names.
For maximum interoparability it is probably best to set the encoding to UTF-8, enable thelanguage encoding flag and create Unicode extra fields when writing ZIPs. Such archives should beextracted correctly by java.util.zip
, 7Zip, WinZIP, PKWARE tools and mostlikely InfoZIP tools. They will be unusable with Windows' 'compressed folders' feature and biggerthan archives without the Unicode extra fields, though.
If Windows' 'compressed folders' is your primary consumer, then your best option is to explicitlyset the encoding to the target platform. You may want to enable creation of Unicode extra fields sothe tools that support them will extract the file names correctly.
Zip64 extensions
Zip64 extensions provide a way to create archives bigger than 4 GB or holding more than 65535entries—or add individual entries bigger than 4 GB using the ZIP extension field mechanism.These extensions are supported by most modern ZIP implementations.
When Ant writes compressed entries into the archive it creates it doesn't know the compressedsize of an entry before it has been written. Unfortunately the decision whether a Zip64 extra fieldwill be written has to be made before writing the entry's content.
Ant 1.9.0 introduced support for Zip64 extensions but didn't provide any control over theirusage. Since Ant 1.9.1, a new zip64mode attribute was added tothe zip
family of tasks. It supports three values:
never
means no Zip64 extra fields will ever be written. This is the behavior of Ant prior to 1.9.0 and the default behavior ofjar
,ear
andwar
since Ant 1.9.1.always
means Zip64 extra fields are written for all entries.as-needed
means Zip64 extra fields are written for all compressed entries to the 'local file header' (by default these are all files but not the directories) but only written to the central directory if the entry really required Zip64 features. This is the default behavior of Ant 1.9.0 and remains the default behavior of thezip
task.
as-needed
provides a good compromise if you don't know whether you archive will exceed thelimits of traditional zip files but don't want to waste too much space (the Zip64 extensions take upextra space). Unfortunately some ZIP implementations don't understand Zip64 extra fields or fail toparse archives with extra fields in local file headers that are not present in the centraldirectory, one such implementation is the java.util.zip
package of Java 5,that's why the jar
tasks default to never
. Archives createdwith as-needed
can be read without problems with Java 6 and later.
Parameters specified as nested elements
any resource collection
resource collections are used to select groupsof files to archive.
Prior to Ant 1.7 only <fileset>
and <zipfileset>
have beensupported as nested elements.
Getspc Zip File Opener
zipgroupfileset
A <zipgroupfileset>
allows for multiple zip files to be merged into thearchive. Each file found in this fileset is added to the archive the same waythat zipfileset
src files are added.
<zipgroupfileset>
is a fileset andsupports all of its attributes and nested elements.
Examples
Zip all files in the htdocs/manual directory into a filecalled manual.zip in the ${dist} directory.
Zip all files in the htdocs/manual directory into a filecalled manual.zip in the ${dist} directory. If manual.zipdoesn't exist, it is created; otherwise it is updated with the new/changed files.
Zip all files in the htdocs/manual directory. Files in thedirectory mydocs, or files with the name todo.html are excluded.
Zip all files in the htdocs/manual directory. Only html files under thedirectory api are zipped, and files with the name todo.html areexcluded.
Zip all files in the htdocs/manual directory, and also add thefile ChangeLog.txt in the current directory. ChangeLog.txt will be addedto the top of the ZIP file, just as if it had been locatedat htdocs/manual/ChangeLog.txt.
Zip all files in the htdocs/manual directory into the docs/user-guidedirectory in the archive, adds the file ChangeLog27.txt in the current directoryas docs/ChangeLog.txt, and includes all the html filesin examples.zip under docs/examples.
The archive might end up containing the files:
Zip all files in the htdocs/manual directory into the docs/user-guidedirectory in the archive and include all the files in any file thatmatches examples*.zip, such as all files within examples1.zipor examples_for_brian.zip.
The same can be achieved with
Re-package a TAR archive as a ZIP archive. If Unix file permissions have been stored as part ofthe TAR file, they will be retained in the resulting ZIP archive.
Instructors are able to upload a zip file of papers to a Turnitin assignment. The zip file may be any size up to 200MB and contain up to 1000 individual files. If the zip file exceeds either limit it will be rejected.
All files must be unique within the a .zip file upload.
- On the class homepage, click on the More actions link next to the Paper assignment that you would like to submit to and select Submit paper.
- Select Zip file upload from the choose a paper submission method: pull down menu. Single file upload is the default submission type for new users.
- Click on Choose File and select the zip file that will be uploaded
Zip files can contain a maximum of 1000 papers
Please check the contents of your zip file. Check the number of documents in the zip file. If it contains more than 1000 papers, the system will take a minimum of an hour to detect the error and the zip file will not be uploaded.
The zip file must be less than 200 MB and individual files must be less than 100 MB each
If your file contains images, you may remove the images or save the file as a rich text or plain text file to make the file smaller. If your file is a PDF and exceeds the 100 MB restriction: (1) copy the text in the document, (2) change the upload process to 'copy and paste', and (3) paste the text in the body field.
- The maximum paper length for individual files is 800 pages each
- All file types are allowed and can receive marks in Online Grading and PeerMark; however, only Microsoft Word, PowerPoint, WordPerfect, PostScript, PDF, HTML, RTF, OpenOffice (ODT), Hangul (HWP), Google Docs, and plain text files with at least 20 words of text will be eligible to receive Originality Reports
- The maximum paper length for individual files is 800 pages each
- Click Upload to load the zip file and view the list of papers. A status bar indicating upload progress should be shown. Once uploaded the paper will be redirected to the File Submission Preview page.
- Once your zip file has been successfully uploaded, the individual files within the zip file will appear in the File Submission Preview list. Select an enrolled student name using the dropdown menu on the submission page. Papers submitted by an instructor on behalf of a student will appear in the student portfolio.
- Once your first file has been successfully uploaded, the file will appear within the File Submission Preview list. To submit on behalf of a non-enrolled student, ensure that 'non-enrolled student' is selected from the Student dropdown list, and enter their last and first name in the respective text boxes. If you submit on behalf of an non-enrolled student they will be unable to view the submission, even after you have added them to the class.
- Once your zip file has been successfully uploaded, the individual files within the zip file will appear in the File Submission Preview list. Select an enrolled student name using the dropdown menu on the submission page. Papers submitted by an instructor on behalf of a student will appear in the student portfolio.
- Enter the title for the paper. If no paper title is entered, the title defaults to the file name for the submitted file
- When all the desired files are attached, review the student names and assignment titles
- Files can be excluded from the submission by removing the check from the check box to the left of the file name under the Submit column.
- When all the desired files are attached, review the student names and assignment titles
- Once the files to submit from the zip file have been selected and (if needed) assigned name and title information, you must click on Submit to continue the upload of papers into the assignment.
- A confirmation screen will be shown listing all file names, author names, Email user profiles, and submission titles. Any fields containing Anonymous or Not Entered are not required, but may be set by using the Go back button to return to the previous screen
- Click Submit to finalize the zip file upload into the assignment. Otherwise, click Go back to make any necessary amendments. A progress bar will display the remaining time for the upload.
If you have the time, we'd love to know how we could improve it.
The guide